diff --git a/game/game.py b/game/game.py index d825c3f9..93cdeb9a 100644 --- a/game/game.py +++ b/game/game.py @@ -175,6 +175,7 @@ class Game: else: return event.name == self.player_name + # 1 = red, 2 = blue def get_player_coalition_id(self): if self.player_country in db.BLUEFOR_FACTIONS: return 2 @@ -187,6 +188,20 @@ class Game: else: return 1 + def get_player_color(self): + if self.get_player_coalition_id() == 1: + return "red" + else: + return "blue" + + def get_enemy_color(self): + if self.get_player_coalition_id() == 1: + return "blue" + else: + return "red" + + + def pass_turn(self, no_action=False, ignored_cps: typing.Collection[ControlPoint] = None): logging.info("Pass turn") diff --git a/liberation_theme.json b/liberation_theme.json new file mode 100644 index 00000000..7fa657ab --- /dev/null +++ b/liberation_theme.json @@ -0,0 +1 @@ +{"theme_index": 1} \ No newline at end of file diff --git a/qt_ui/main.py b/qt_ui/main.py index 5c6a033b..62254fc0 100644 --- a/qt_ui/main.py +++ b/qt_ui/main.py @@ -1,7 +1,7 @@ from userdata import logging_config # Logging setup -VERSION_STRING = "2.0RC7" +VERSION_STRING = "2.0RC9" logging_config.init_logging(VERSION_STRING) import logging @@ -17,19 +17,18 @@ from qt_ui import uiconstants from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.QLiberationWindow import QLiberationWindow from qt_ui.windows.preferences.QLiberationFirstStartWindow import QLiberationFirstStartWindow -from userdata import liberation_install, persistency +from userdata import liberation_install, persistency, liberation_theme if __name__ == "__main__": app = QApplication(sys.argv) + # init the theme and load the stylesheet based on the theme index + liberation_theme.init(); css = "" - with open("./resources/stylesheets/style.css") as stylesheet: + with open("./resources/stylesheets/"+liberation_theme.get_theme_css_file()) as stylesheet: app.setStyleSheet(stylesheet.read()) - - - # Inject custom payload in pydcs framework custom_payloads = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\\resources\\customized_payloads") if os.path.exists(custom_payloads): diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index be107c02..56696477 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -6,6 +6,7 @@ from PySide2.QtGui import QColor, QFont, QPixmap from game.event import UnitsDeliveryEvent, FrontlineAttackEvent from theater.theatergroundobject import CATEGORY_MAP +from userdata.liberation_theme import get_theme_icons URLS : Dict[str, str] = { "Manual": "https://github.com/khopa/dcs_liberation/wiki", @@ -19,26 +20,58 @@ URLS : Dict[str, str] = { LABELS_OPTIONS = ["Full", "Abbreviated", "Dot Only", "Off"] SKILL_OPTIONS = ["Average", "Good", "High", "Excellent"] -COLORS: Dict[str, QColor] = { - "dark_red": QColor(140, 20, 20), - "red": QColor(200, 80, 80), - "bright_red": QColor(150, 80, 80), - "super_red": QColor(200, 120, 120), - "blue": QColor(164, 164, 255), - "dark_blue": QColor(45, 62, 80), - "white": QColor(255, 255, 255), - "green": QColor(128, 186, 128), - "bright_green": QColor(64, 200, 64), - "black": QColor(0, 0, 0), - "black_transparent": QColor(0, 0, 0, 64), - "blue_transparent": QColor(164, 164, 255, 32), - "red_transparent": QColor(255, 125, 125, 32) +FONT_SIZE = 8 +FONT_NAME = "Arial" +# FONT = QFont("Arial", 12, weight=5, italic=True) +FONT_PRIMARY = QFont(FONT_NAME, FONT_SIZE, weight=5, italic=False) +FONT_PRIMARY_I = QFont(FONT_NAME, FONT_SIZE, weight=5, italic=True) +FONT_PRIMARY_B = QFont(FONT_NAME, FONT_SIZE, weight=75, italic=False) +FONT_MAP = QFont(FONT_NAME, 10, weight=75, italic=False) + +# new themes can be added here +THEMES: Dict[int, Dict[str, str]] = { + 0: {'themeName': 'Vanilla', + 'themeFile': 'windows-style.css', + 'themeIcons': 'medium', + }, + + 1: {'themeName': 'DCS World', + 'themeFile': 'style-dcs.css', + 'themeIcons': 'light', + }, + } +COLORS: Dict[str, QColor] = { + "white": QColor(255, 255, 255), + "white_transparent": QColor(255, 255, 255, 35), + "grey_transparent": QColor(150, 150, 150, 30), -CP_SIZE = 25 -FONT = QFont("Arial", 12, weight=5, italic=True) + "red": QColor(200, 80, 80), + "dark_red": QColor(140, 20, 20), + "red_transparent": QColor(227, 32, 0, 20), + "blue": QColor(0, 132, 255), + "dark_blue": QColor(45, 62, 80), + "blue_transparent": QColor(0, 132, 255, 20), + + "bright_red": QColor(150, 80, 80), + "super_red": QColor(227, 32, 0), + + "green": QColor(128, 186, 128), + "bright_green": QColor(64, 200, 64), + + "black": QColor(0, 0, 0), + "black_transparent": QColor(0, 0, 0, 5), + + "orange": QColor(254, 125, 10), + + "night_overlay": QColor(12, 20, 69), + "dawn_dust_overlay": QColor(46, 38, 85), + +} + +CP_SIZE = 24 AIRCRAFT_ICONS: Dict[str, QPixmap] = {} VEHICLES_ICONS: Dict[str, QPixmap] = {} @@ -46,9 +79,9 @@ ICONS: Dict[str, QPixmap] = {} def load_icons(): - ICONS["New"] = QPixmap("./resources/ui/misc/new.png") - ICONS["Open"] = QPixmap("./resources/ui/misc/open.png") - ICONS["Save"] = QPixmap("./resources/ui/misc/save.png") + ICONS["New"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/new.png") + ICONS["Open"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/open.png") + ICONS["Save"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/save.png") ICONS["Terrain_Caucasus"] = QPixmap("./resources/ui/terrain_caucasus.gif") ICONS["Terrain_Persian_Gulf"] = QPixmap("./resources/ui/terrain_pg.gif") @@ -61,12 +94,12 @@ def load_icons(): ICONS["Dusk"] = QPixmap("./resources/ui/daytime/dusk.png") ICONS["Night"] = QPixmap("./resources/ui/daytime/night.png") - ICONS["Money"] = QPixmap("./resources/ui/misc/money_icon.png") - ICONS["PassTurn"] = QPixmap("./resources/ui/misc/hourglass.png") - ICONS["Proceed"] = QPixmap("./resources/ui/misc/proceed.png") - ICONS["Settings"] = QPixmap("./resources/ui/misc/settings.png") - ICONS["Statistics"] = QPixmap("./resources/ui/misc/statistics.png") - ICONS["Ordnance"] = QPixmap("./resources/ui/misc/ordnance_icon.png") + ICONS["Money"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/money_icon.png") + ICONS["PassTurn"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/hourglass.png") + ICONS["Proceed"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/proceed.png") + ICONS["Settings"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/settings.png") + ICONS["Statistics"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/statistics.png") + ICONS["Ordnance"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/ordnance_icon.png") ICONS["target"] = QPixmap("./resources/ui/ground_assets/target.png") ICONS["cleared"] = QPixmap("./resources/ui/ground_assets/cleared.png") @@ -77,9 +110,9 @@ def load_icons(): ICONS["ship"] = QPixmap("./resources/ui/ground_assets/ship.png") ICONS["ship_blue"] = QPixmap("./resources/ui/ground_assets/ship_blue.png") - ICONS["Generator"] = QPixmap("./resources/ui/misc/generator.png") - ICONS["Missile"] = QPixmap("./resources/ui/misc/missile.png") - ICONS["Cheat"] = QPixmap("./resources/ui/misc/cheat.png") + ICONS["Generator"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/generator.png") + ICONS["Missile"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/missile.png") + ICONS["Cheat"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/cheat.png") ICONS["TaskCAS"] = QPixmap("./resources/ui/tasks/cas.png") ICONS["TaskCAP"] = QPixmap("./resources/ui/tasks/cap.png") diff --git a/qt_ui/widgets/QTopPanel.py b/qt_ui/widgets/QTopPanel.py index 901bef6d..2a77cb23 100644 --- a/qt_ui/widgets/QTopPanel.py +++ b/qt_ui/widgets/QTopPanel.py @@ -34,7 +34,7 @@ class QTopPanel(QFrame): self.proceedButton = QPushButton("Mission Planning") self.proceedButton.setIcon(CONST.ICONS["Proceed"]) - self.proceedButton.setProperty("style", "btn-primary") + self.proceedButton.setProperty("style", "btn-success") self.proceedButton.clicked.connect(self.proceed) if self.game and self.game.turn == 0: self.proceedButton.setEnabled(False) diff --git a/qt_ui/widgets/map/QLiberationMap.py b/qt_ui/widgets/map/QLiberationMap.py index 1f18d11e..848d9649 100644 --- a/qt_ui/widgets/map/QLiberationMap.py +++ b/qt_ui/widgets/map/QLiberationMap.py @@ -113,6 +113,9 @@ class QLiberationMap(QGraphicsView): scene = self.scene() scene.clear() + playerColor = self.game.get_player_color() + enemyColor = self.game.get_enemy_color() + self.addBackground() # Uncomment below to help set up theater reference points @@ -128,11 +131,11 @@ class QLiberationMap(QGraphicsView): CONST.CP_SIZE, cp, self.game)) if cp.captured: - pen = QPen(brush=CONST.COLORS["blue"]) - brush = CONST.COLORS["blue_transparent"] + pen = QPen(brush=CONST.COLORS[playerColor]) + brush = CONST.COLORS[playerColor+"_transparent"] else: - pen = QPen(brush=CONST.COLORS["red"]) - brush = CONST.COLORS["red_transparent"] + pen = QPen(brush=CONST.COLORS[enemyColor]) + brush = CONST.COLORS[enemyColor+"_transparent"] added_objects = [] for ground_object in cp.ground_objects: @@ -157,34 +160,35 @@ class QLiberationMap(QGraphicsView): if unit.threat_range > max_range: max_range = unit.threat_range if has_radar: - scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, pen, brush) + scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, CONST.COLORS["white_transparent"], CONST.COLORS["grey_transparent"]) added_objects.append(ground_object.obj_name) for cp in self.game.theater.enemy_points(): if self.get_display_rule("lines"): - self.scene_create_lines_for_cp(cp) + self.scene_create_lines_for_cp(cp, playerColor, enemyColor) + for cp in self.game.theater.player_points(): if self.get_display_rule("lines"): - self.scene_create_lines_for_cp(cp) + self.scene_create_lines_for_cp(cp, playerColor, enemyColor) for cp in self.game.theater.controlpoints: if cp.captured: - pen = QPen(brush=CONST.COLORS["blue"]) - brush = CONST.COLORS["blue_transparent"] + pen = QPen(brush=CONST.COLORS[playerColor]) + brush = CONST.COLORS[playerColor+"_transparent"] + + flight_path_pen = QPen(brush=CONST.COLORS[playerColor]) + flight_path_pen.setColor(CONST.COLORS[playerColor]) - flight_path_pen = QPen(brush=CONST.COLORS["blue"]) - flight_path_pen.setColor(CONST.COLORS["blue"]) - flight_path_pen.setWidth(1) - flight_path_pen.setStyle(Qt.DashDotLine) else: - pen = QPen(brush=CONST.COLORS["red"]) - brush = CONST.COLORS["red_transparent"] + pen = QPen(brush=CONST.COLORS[enemyColor]) + brush = CONST.COLORS[enemyColor+"_transparent"] - flight_path_pen = QPen(brush=CONST.COLORS["bright_red"]) - flight_path_pen.setColor(CONST.COLORS["bright_red"]) - flight_path_pen.setWidth(1) - flight_path_pen.setStyle(Qt.DashDotLine) + flight_path_pen = QPen(brush=CONST.COLORS[enemyColor]) + flight_path_pen.setColor(CONST.COLORS[enemyColor]) + + flight_path_pen.setWidth(1) + flight_path_pen.setStyle(Qt.DashDotLine) pos = self._transform_point(cp.position) if self.get_display_rule("flight_paths"): @@ -202,27 +206,27 @@ class QLiberationMap(QGraphicsView): for cp in self.game.theater.controlpoints: pos = self._transform_point(cp.position) - text = scene.addText(cp.name, font=QFont("Trebuchet MS", 10, weight=5, italic=False)) + text = scene.addText(cp.name, font=CONST.FONT_MAP) text.setPos(pos[0] + CONST.CP_SIZE, pos[1] - CONST.CP_SIZE / 2) - text = scene.addText(cp.name, font=QFont("Trebuchet MS", 10, weight=5, italic=False)) + text = scene.addText(cp.name, font=CONST.FONT_MAP) text.setDefaultTextColor(Qt.white) text.setPos(pos[0] + CONST.CP_SIZE + 1, pos[1] - CONST.CP_SIZE / 2 + 1) - def scene_create_lines_for_cp(self, cp: ControlPoint): + def scene_create_lines_for_cp(self, cp: ControlPoint, playerColor, enemyColor): scene = self.scene() pos = self._transform_point(cp.position) for connected_cp in cp.connected_points: pos2 = self._transform_point(connected_cp.position) if not cp.captured: - color = CONST.COLORS["red"] + color = CONST.COLORS["dark_"+enemyColor] elif cp.captured: - color = CONST.COLORS["blue"] + color = CONST.COLORS["dark_"+playerColor] else: - color = CONST.COLORS["red"] + color = CONST.COLORS["dark_"+enemyColor] pen = QPen(brush=color) pen.setColor(color) - pen.setWidth(16) + pen.setWidth(6) if cp.captured and not connected_cp.captured and Conflict.has_frontline_between(cp, connected_cp): if not cp.captured: scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen) @@ -234,8 +238,8 @@ class QLiberationMap(QGraphicsView): p1 = point_from_heading(pos2[0], pos2[1], h+180, 25) p2 = point_from_heading(pos2[0], pos2[1], h, 25) frontline_pen = QPen(brush=CONST.COLORS["bright_red"]) - frontline_pen.setColor(CONST.COLORS["bright_red"]) - frontline_pen.setWidth(18) + frontline_pen.setColor(CONST.COLORS["orange"]) + frontline_pen.setWidth(8) scene.addLine(p1[0], p1[1], p2[0], p2[1], pen=frontline_pen) else: @@ -318,14 +322,14 @@ class QLiberationMap(QGraphicsView): pass elif self.game.current_turn_daytime == "night": ov = QPixmap(bg.width(), bg.height()) - ov.fill(QColor(40, 40, 150)) + ov.fill(CONST.COLORS["night_overlay"]) overlay = scene.addPixmap(ov) effect = QGraphicsOpacityEffect() effect.setOpacity(0.7) overlay.setGraphicsEffect(effect) else: ov = QPixmap(bg.width(), bg.height()) - ov.fill(QColor(165, 100, 100)) + ov.fill(CONST.COLORS["dawn_dust_overlay"]) overlay = scene.addPixmap(ov) effect = QGraphicsOpacityEffect() effect.setOpacity(0.3) diff --git a/qt_ui/widgets/map/QLiberationScene.py b/qt_ui/widgets/map/QLiberationScene.py index c13ac0fe..c6989298 100644 --- a/qt_ui/widgets/map/QLiberationScene.py +++ b/qt_ui/widgets/map/QLiberationScene.py @@ -1,7 +1,7 @@ from PySide2.QtGui import QFont from PySide2.QtWidgets import QGraphicsScene -from qt_ui.uiconstants import COLORS +import qt_ui.uiconstants as CONST class QLiberationScene(QGraphicsScene): @@ -9,5 +9,5 @@ class QLiberationScene(QGraphicsScene): def __init__(self, parent): super().__init__(parent) item = self.addText("No save file found. Go to \"File/New Game\" to setup a new campaign.", - QFont("Arial", 14, weight=5)) - item.setDefaultTextColor(COLORS["white"]) + CONST.FONT_PRIMARY) + item.setDefaultTextColor(CONST.COLORS["white"]) diff --git a/qt_ui/widgets/map/QMapControlPoint.py b/qt_ui/widgets/map/QMapControlPoint.py index 774d1d77..f993c73a 100644 --- a/qt_ui/widgets/map/QMapControlPoint.py +++ b/qt_ui/widgets/map/QMapControlPoint.py @@ -96,10 +96,7 @@ class QMapControlPoint(QGraphicsRectItem): @property def pen_color(self) -> QColor: - if self.parent.game.player_country in db.BLUEFOR_FACTIONS: - return self.model.captured and CONST.COLORS["dark_blue"] or CONST.COLORS["bright_red"] - else: - return self.model.captured and CONST.COLORS["bright_red"] or CONST.COLORS["dark_blue"] + return self.model.captured and CONST.COLORS["white"] or CONST.COLORS["white"] def openBaseMenu(self): self.baseMenu = QBaseMenu2(self.window(), self.model, self.game) diff --git a/qt_ui/widgets/map/QMapEvent.py b/qt_ui/widgets/map/QMapEvent.py index 13570bdf..5e24f35e 100644 --- a/qt_ui/widgets/map/QMapEvent.py +++ b/qt_ui/widgets/map/QMapEvent.py @@ -17,17 +17,22 @@ class QMapEvent(QGraphicsRectItem): self.setToolTip(str(self.gameEvent)) self.playable = not isinstance(self.gameEvent, UnitsDeliveryEvent) + + def paint(self, painter, option, widget=None): + playerColor = self.game.get_player_color() + enemyColor = self.game.get_enemy_color() + if self.parent.get_display_rule("events"): painter.save() if self.gameEvent.is_player_attacking: - painter.setPen(QPen(brush=CONST.COLORS["blue"])) - painter.setBrush(CONST.COLORS["blue"]) + painter.setPen(QPen(brush=CONST.COLORS[playerColor])) + painter.setBrush(CONST.COLORS[playerColor]) else: - painter.setPen(QPen(brush=CONST.COLORS["red"])) - painter.setBrush(CONST.COLORS["red"]) + painter.setPen(QPen(brush=CONST.COLORS[enemyColor])) + painter.setBrush(CONST.COLORS[enemyColor]) if self.isUnderMouse() and self.playable: painter.setBrush(CONST.COLORS["white"]) diff --git a/qt_ui/widgets/map/QMapGroundObject.py b/qt_ui/widgets/map/QMapGroundObject.py index b28f2ea6..ea867638 100644 --- a/qt_ui/widgets/map/QMapGroundObject.py +++ b/qt_ui/widgets/map/QMapGroundObject.py @@ -42,6 +42,13 @@ class QMapGroundObject(QGraphicsRectItem): def paint(self, painter, option, widget=None): #super(QMapControlPoint, self).paint(painter, option, widget) + if self.parent.game.player_country in db.BLUEFOR_FACTIONS: + playerIcons = "_blue" + enemyIcons = "" + else: + playerIcons = "" + enemyIcons = "_blue" + if self.parent.get_display_rule("go"): painter.save() @@ -50,9 +57,9 @@ class QMapGroundObject(QGraphicsRectItem): cat = "ship" if not self.model.is_dead and not self.cp.captured: - painter.drawPixmap(option.rect, CONST.ICONS[cat]) + painter.drawPixmap(option.rect, CONST.ICONS[cat + enemyIcons]) elif not self.model.is_dead: - painter.drawPixmap(option.rect, CONST.ICONS[cat + "_blue"]) + painter.drawPixmap(option.rect, CONST.ICONS[cat + playerIcons]) else: painter.drawPixmap(option.rect, CONST.ICONS["destroyed"]) painter.restore() diff --git a/qt_ui/windows/QNewGameWizard.py b/qt_ui/windows/QNewGameWizard.py index f858b084..cecd0ea4 100644 --- a/qt_ui/windows/QNewGameWizard.py +++ b/qt_ui/windows/QNewGameWizard.py @@ -108,7 +108,7 @@ class NewGameWizard(QtWidgets.QWizard): game.budget = int(game.budget * multiplier) game.settings.multiplier = multiplier game.settings.sams = True - game.settings.version = "2.0RC7" + game.settings.version = "2.0RC9" if midgame: game.budget = game.budget * 4 * len(list(conflicttheater.conflicts())) @@ -140,7 +140,7 @@ class FactionSelection(QtWidgets.QWizardPage): self.setTitle("Faction selection") self.setSubTitle("\nChoose the two opposing factions and select the player side.") self.setPixmap(QtWidgets.QWizard.LogoPixmap, - QtGui.QPixmap('./resources/ui/wizard/logo1.png')) + QtGui.QPixmap('./resources/ui/misc/generator.png')) self.setMinimumHeight(250) @@ -167,10 +167,10 @@ class FactionSelection(QtWidgets.QWizardPage): # Unit Preview self.blueSideRecap = QtWidgets.QLabel("") - self.blueSideRecap.setFont(QtGui.QFont("Arial", italic=True)) + self.blueSideRecap.setFont(CONST.FONT_PRIMARY_I) self.blueSideRecap.setWordWrap(True) self.redSideRecap = QtWidgets.QLabel("") - self.redSideRecap.setFont(QtGui.QFont("Arial", italic=True)) + self.redSideRecap.setFont(CONST.FONT_PRIMARY_I) self.redSideRecap.setWordWrap(True) # Link form fields diff --git a/qt_ui/windows/basemenu/QRecruitBehaviour.py b/qt_ui/windows/basemenu/QRecruitBehaviour.py index 096caeff..97c1d56e 100644 --- a/qt_ui/windows/basemenu/QRecruitBehaviour.py +++ b/qt_ui/windows/basemenu/QRecruitBehaviour.py @@ -28,13 +28,13 @@ class QRecruitBehaviour: existing_units = QLabel(str(existing_units)) existing_units.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) - amount_bought = QLabel("[{}]".format(str(scheduled_units))) + amount_bought = QLabel("{}".format(str(scheduled_units))) amount_bought.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.existing_units_labels[unit_type] = existing_units self.bought_amount_labels[unit_type] = amount_bought - price = QLabel("{}m".format(db.PRICES[unit_type])) + price = QLabel("$ {} m".format(db.PRICES[unit_type])) price.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) buy = QPushButton("+") @@ -52,17 +52,18 @@ class QRecruitBehaviour: layout.addWidget(unitName, row, 0) layout.addItem(QSpacerItem(20, 0, QSizePolicy.Minimum, QSizePolicy.Minimum), row, 1) layout.addWidget(existing_units, row, 2) - layout.addWidget(amount_bought, row, 3) + layout.addItem(QSpacerItem(20, 0, QSizePolicy.Minimum, QSizePolicy.Minimum), row, 3) layout.addWidget(price, row, 4) - layout.addItem(QSpacerItem(20, 0, QSizePolicy.Minimum, QSizePolicy.Minimum), row, 5) - layout.addWidget(buy, row, 6) - layout.addWidget(sell, row, 7) + + layout.addWidget(sell, row, 5) + layout.addWidget(amount_bought, row, 6) + layout.addWidget(buy, row, 7) return row + 1 def _update_count_label(self, unit_type: UnitType): - self.bought_amount_labels[unit_type].setText("[{}]".format( + self.bought_amount_labels[unit_type].setText("{}".format( unit_type in self.deliveryEvent.units and "{}".format(self.deliveryEvent.units[unit_type]) or "0" )) diff --git a/qt_ui/windows/infos/QInfoPanel.py b/qt_ui/windows/infos/QInfoPanel.py index a7a81d56..6b31afa3 100644 --- a/qt_ui/windows/infos/QInfoPanel.py +++ b/qt_ui/windows/infos/QInfoPanel.py @@ -22,7 +22,7 @@ class QInfoPanel(QGroupBox): layout = QVBoxLayout() layout.addWidget(self.informations_list) layout.setSpacing(0) - layout.setContentsMargins(0, 0, 0, 0) + layout.setContentsMargins(0, 20, 0, 0) self.setLayout(layout) diff --git a/qt_ui/windows/mission/QMissionPlanning.py b/qt_ui/windows/mission/QMissionPlanning.py index 858df43a..d1e513ce 100644 --- a/qt_ui/windows/mission/QMissionPlanning.py +++ b/qt_ui/windows/mission/QMissionPlanning.py @@ -51,12 +51,13 @@ class QMissionPlanning(QDialog): self.add_flight_button = QPushButton("Add Flight") self.add_flight_button.clicked.connect(self.on_add_flight) self.delete_flight_button = QPushButton("Delete Selected") + self.delete_flight_button.setProperty("style", "btn-danger") self.delete_flight_button.clicked.connect(self.on_delete_flight) self.button_layout = QHBoxLayout() self.button_layout.addStretch() - self.button_layout.addWidget(self.add_flight_button) self.button_layout.addWidget(self.delete_flight_button) + self.button_layout.addWidget(self.add_flight_button) self.mission_start_button = QPushButton("Take Off") self.mission_start_button.setProperty("style", "start-button") diff --git a/qt_ui/windows/preferences/QLiberationPreferences.py b/qt_ui/windows/preferences/QLiberationPreferences.py index eba000fe..074c1c17 100644 --- a/qt_ui/windows/preferences/QLiberationPreferences.py +++ b/qt_ui/windows/preferences/QLiberationPreferences.py @@ -1,11 +1,16 @@ import os from PySide2 import QtWidgets +from PySide2.QtCore import QFile from PySide2.QtGui import Qt from PySide2.QtWidgets import QFrame, QLineEdit, QGridLayout, QVBoxLayout, QLabel, QPushButton, \ - QFileDialog, QMessageBox, QDialog + QFileDialog, QMessageBox, QDialog, QComboBox, QApplication +import qt_ui.uiconstants as CONST +import sys -from userdata import liberation_install +import userdata +from userdata import liberation_install, liberation_theme +from userdata.liberation_theme import get_theme_index, set_theme_index class QLiberationPreferences(QFrame): @@ -28,6 +33,8 @@ class QLiberationPreferences(QFrame): self.browse_saved_game.clicked.connect(self.on_browse_saved_games) self.browse_install_dir = QPushButton("Browse...") self.browse_install_dir.clicked.connect(self.on_browse_installation_dir) + self.themeSelect = QComboBox() + [self.themeSelect.addItem(y['themeName']) for x, y in CONST.THEMES.items()] self.initUi() @@ -40,6 +47,9 @@ class QLiberationPreferences(QFrame): layout.addWidget(QLabel("DCS installation directory:"), 2, 0, alignment=Qt.AlignLeft) layout.addWidget(self.edit_dcs_install_dir, 3, 0, alignment=Qt.AlignRight) layout.addWidget(self.browse_install_dir, 3, 1, alignment=Qt.AlignRight) + layout.addWidget(QLabel("Theme (Requires Restart)"), 4, 0) + layout.addWidget(self.themeSelect, 4, 1, alignment=Qt.AlignRight) + self.themeSelect.setCurrentIndex(get_theme_index()) main_layout.addLayout(layout) main_layout.addStretch() @@ -63,6 +73,7 @@ class QLiberationPreferences(QFrame): print("Applying changes") self.saved_game_dir = self.edit_saved_game_dir.text() self.dcs_install_dir = self.edit_dcs_install_dir.text() + set_theme_index(self.themeSelect.currentIndex()) if not os.path.isdir(self.saved_game_dir): error_dialog = QMessageBox.critical(self, "Wrong DCS Saved Games directory.", @@ -78,7 +89,8 @@ class QLiberationPreferences(QFrame): error_dialog.exec_() return False - if not os.path.isdir(os.path.join(self.dcs_install_dir, "Scripts")) and os.path.isfile(os.path.join(self.dcs_install_dir, "bin", "DCS.exe")): + if not os.path.isdir(os.path.join(self.dcs_install_dir, "Scripts")) and os.path.isfile( + os.path.join(self.dcs_install_dir, "bin", "DCS.exe")): error_dialog = QMessageBox.critical(self, "Wrong DCS installation directory.", self.dcs_install_dir + " is not a valid DCS installation directory", QMessageBox.StandardButton.Ok) @@ -87,7 +99,5 @@ class QLiberationPreferences(QFrame): liberation_install.setup(self.saved_game_dir, self.dcs_install_dir) liberation_install.save_config() + liberation_theme.save_theme_config() return True - - - diff --git a/resources/caumap.gif b/resources/caumap.gif index 7c2d9ea2..53a4a774 100644 Binary files a/resources/caumap.gif and b/resources/caumap.gif differ diff --git a/resources/nevada.gif b/resources/nevada.gif index d57b199e..ce6eafe8 100644 Binary files a/resources/nevada.gif and b/resources/nevada.gif differ diff --git a/resources/normandy.gif b/resources/normandy.gif index b170b795..91d00e2d 100644 Binary files a/resources/normandy.gif and b/resources/normandy.gif differ diff --git a/resources/persiangulf.gif b/resources/persiangulf.gif index c7940924..9341d619 100644 Binary files a/resources/persiangulf.gif and b/resources/persiangulf.gif differ diff --git a/resources/scripts/MissionScripting.original.lua b/resources/scripts/MissionScripting.original.lua new file mode 100644 index 00000000..29dcd2fe --- /dev/null +++ b/resources/scripts/MissionScripting.original.lua @@ -0,0 +1,21 @@ +--Initialization script for the Mission lua Environment (SSE) + +dofile('Scripts/ScriptingSystem.lua') + +--Sanitize Mission Scripting environment +--This makes unavailable some unsecure functions. +--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions. +--You can remove the code below and make availble these functions at your own risk. + +local function sanitizeModule(name) + _G[name] = nil + package.loaded[name] = nil +end + +do + sanitizeModule('os') + sanitizeModule('io') + sanitizeModule('lfs') + require = nil + loadlib = nil +end \ No newline at end of file diff --git a/resources/stylesheets/check-hover.png b/resources/stylesheets/check-hover.png new file mode 100644 index 00000000..71fd2ad5 Binary files /dev/null and b/resources/stylesheets/check-hover.png differ diff --git a/resources/stylesheets/check.png b/resources/stylesheets/check.png new file mode 100644 index 00000000..e1b612b3 Binary files /dev/null and b/resources/stylesheets/check.png differ diff --git a/resources/stylesheets/chevron-down.png b/resources/stylesheets/chevron-down.png new file mode 100644 index 00000000..186aa21e Binary files /dev/null and b/resources/stylesheets/chevron-down.png differ diff --git a/resources/stylesheets/chevron-up.png b/resources/stylesheets/chevron-up.png new file mode 100644 index 00000000..8eb856b3 Binary files /dev/null and b/resources/stylesheets/chevron-up.png differ diff --git a/resources/stylesheets/style-dcs.css b/resources/stylesheets/style-dcs.css new file mode 100644 index 00000000..ba01ba58 --- /dev/null +++ b/resources/stylesheets/style-dcs.css @@ -0,0 +1,442 @@ +/*ui theme based on dcs*/ + + +/* +colors + +Backgrounds +blue ------------------------ #2D3E50 +dark blue ------------------- #1D2731 +med/grey/blue --------------- #435466 +dark grey ------------------- #4E5760 +button blue/grey gradient --- qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #A4B3B9, stop:1 #85989D); +button green gradient --- qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #82A466, stop:1 #5C863F); + +Text +white text ------------------- #ffffff +blue text -------------------- #3592C4 +grey text -------------------- #B7C0C6 + +*/ + +/*QMenuBar*/ +QMenuBar { + spacing: 2px; /* spacing between menu bar items */ + border-bottom:none; +} + +QMenuBar::item { + padding: 4px 10px; + background: transparent; + border-radius: 2px; + margin: 4px 0; +} + +QMenuBar::item:selected { /* when selected using mouse or keyboard */ + background: #1D2731; +} + +QMenuBar::item:pressed { + background: #1D2731; +} + +QMenu::item:selected { + background: #435466; +} + + +QLabel{ +font-weight:normal; +text-align:right; +} + + +/*QWidget*/ +QWidget { + background-color: #2D3E50; + color:white; +} + + +/*QLiberationWindow*/ +QLiberationWindow{ + background-color: #2D3E50; + color:white; +} + +/*QTopPanel*/ +QTopPanel, +QTopPanel * { + background-color: #1D2731; + color: #B7C0C6; + font-size: 12px; + font-weight: bold; +} + + +/*QPushButton*/ +QPushButton { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #A4B3B9, stop:1 #85989D); + border: 1px solid #97A9A9; + color:#fff; + padding: 6px 10px; + cursor: pointer; + border-radius:2px; +} + +QPushButton:hover { + background: #6c7b7f; + cursor:pointer; +} + +/*btn-primary*/ +QPushButton[style="btn-primary"]{ + background: qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #A4B3B9, stop:1 #85989D); + border: 1px solid #97A9A9; + color:#fff; + padding: 6px 20px; + border-radius:2px; + cursor: pointer; + font-weight:bold; + text-transform:uppercase; +} +QPushButton[style="btn-primary"]:hover{ + background: #6c7b7f; +} + + +/*highlighted buttons*/ +QPushButton[style="btn-success"] , QPushButton[style="start-button"]{ + background-color:#82A466; + color: white; + cursor:pointer; + padding: 6px 20px; + border-radius:2px; + font-weight:bold; + text-transform:uppercase; +} + +QPushButton[style="start-button"]{ + padding: 8px 30px; +} + +QPushButton[style="btn-success"]:hover , QPushButton[style="start-button"]:hover{ + background:#5C863F; +} + +QPushButton[style="btn-danger"]{ + background-color:#9E3232; + color: white; + cursor:pointer; + padding: 6px; + border-radius:2px; + border: 1px solid #9E3232; +} + +QPushButton[style="btn-danger"]:hover{ + background-color:#D84545; +} + +QPushButton:disabled{ + + background:#d6d6d6; +} + +/*QLabel*/ +QLabel{ + border: none; +} + +QLabel[style="base-title"]{ + font-size: 24px; + font-color: #ccc; +} + +QLabel[style="icon-plane"]{ + background-color:#48719D; + min-height:24px; + max-width: 84px; + border: 1px solid black; + text-align:center; + color:white; +} + +QLabel[style="BARCAP"]{ + border: 1px solid black; + background-color: #445299; + color:white; + padding:2px 6px; +} + +QLabel[style="TARCAP"]{ + border: 1px solid black; + background-color: #445299; + color:white; + padding:2px 6px; +} + +QLabel[style="CAP"]{ + border: 1px solid black; + background-color: #445299; + color:white; + padding:2px 6px; +} + +QLabel[style="INTERCEPTION"]{ + border: 1px solid black; + background-color: #7752bc; + color:white; + padding:2px 6px; +} + +QLabel[style="CAS"]{ + border: 1px solid black; + background-color: #ab2244; + color:white; + padding:2px 6px; +} + +QLabel[style="BAI"]{ + border: 1px solid black; + background-color: #ab2244; + color:white; + padding:2px 6px; +} + +QLabel[style="ANTISHIP"]{ + border: 1px solid black; + background-color: #ab2244; + color:white; + padding:2px 6px; +} + +QLabel[style="STRIKE"]{ + border: 1px solid black; + background-color: #ab2244; + color:white; + padding:2px 6px; +} + +QLabel[style="DEAD"]{ + border: 1px solid black; + background-color: #cc8844; + color:white; + padding:2px 6px; +} + +QLabel[style="SEAD"]{ + border: 1px solid black; + background-color: #aa7744; + color:white; + padding:2px 6px; +} + +/*QGroupBox these are the sections that look like fieldsets*/ +QGroupBox { + margin-top: 1ex; /* leave space at the top for the title */ + border:1px solid #435466; + padding:5px; + margin:5px; +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; /* position at the top left */ + padding: 3px; + color: #B7C0C6; + font-weight: 800; +} + + +/*checkboxes*/ +QGroupBox::indicator , QCheckBox::indicator { + width: 14px; + height: 14px; + border: 1px solid #435466; + +} + +QGroupBox::indicator:hover , QCheckBox::indicator:hover { + border-color: #fff; + image: url(resources/stylesheets/check-hover.png); +} + +QGroupBox::indicator:unchecked , QCheckBox::indicator:unchecked { + +} + +QGroupBox::indicator:checked , QCheckBox::indicator:checked { +image: url(resources/stylesheets/check.png); +} + + +/*QDialog*/ +QDialog{ + +} + + +QListView { +border: none; +} + +/*QTabWidget*/ +QTabWidget::pane { /* The tab widget frame */ + border-top: 2px solid #1D2731; +} + +QTabWidget::tab-bar { + +} + +QTabBar::tab { + color:#5B626B; + background: #202C3A; + border-right: 1px solid #14202B; + border-left: 1px solid #14202B; + min-width: 8ex; + padding: 6px 10px; +} + +QTabBar::tab:hover { + background: #1D2731; + color:#fff; +} + +QTabBar::tab:selected { + color:#3592C4; + background:#2C3E4C; +} + + + +/*QComboBox*/ +QComboBox { + border:1px solid #3B4656; + color: #fff; + padding: 4px 10px; + background: #1D2731; +} + +QComboBox::editable { + border:4px solid red; +} + +QComboBox:hover{ + border-color: #3592C4; +} + +QComboBox:disabled, QComboBox::drop-down:disabled{ + color: #B7C0C6; + background: #435466; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + padding: 2px; + border:none; + color: #fff; + height: 20px; +} + +QComboBox::down-arrow { + image: url(resources/stylesheets/chevron-down.png); +} + +QComboBox QAbstractItemView { + padding: 4px; + border:1px solid #3B4656; + background: #465C74; + + } + + +/*QSpinBox number input with up down arrows*/ +QSpinBox{ + border:1px solid #3B4656; + color: #fff; + padding: 4px 10px; + background: #1D2731; + min-width:40px; +} + +QSpinBox:hover{ + border-color: #3592C4; +} + +QSpinBox::up-button , QSpinBox::down-button{ + border:none; +} + +QSpinBox::up-button{ + image: url(resources/stylesheets/chevron-up.png); +} + +QSpinBox::down-button{ + image: url(resources/stylesheets/chevron-down.png); +} + + + +QLineEdit{ + padding: 4px 10px; + border:1px solid #3B4656; + background: #465C74; + color: #fff; + margin-bottom:10px; +} + + +/*table view*/ +QHeaderView{ + background: #4B5B74; +} +QHeaderView::section { + background: #4B5B74; + padding: 4px; + border-style: none; + border-bottom: 1px solid #1D2731; +} + +QHeaderView::section:horizontal +{ + border: none; + text-align:left; + background: #4B5B74; + +} + +QHeaderView::section:vertical +{ + border: none; + text-align:left; + background: #4B5B74; +} +QTableWidget { + gridline-color: #1D2731; + background: #4B5B74; +} + + +/*helper modifiers*/ +*[style="no-border"] { + border:none; +} + +*[style="bordered"]{ + border: 1px solid #1D2731; +} + + +/* +QBaseMenu{ + background-color:#699245; + color:white; +} + +QWidget[style="baseMenuHeader"]{ + font-size: 24px; + font-weight: bold; + color:white; +}*/ diff --git a/resources/stylesheets/windows-style.css b/resources/stylesheets/windows-style.css new file mode 100644 index 00000000..cbf5010f --- /dev/null +++ b/resources/stylesheets/windows-style.css @@ -0,0 +1,3 @@ +/* +windows basis styles +*/ diff --git a/resources/thechannel.gif b/resources/thechannel.gif index 15005ed7..16b75f0a 100644 Binary files a/resources/thechannel.gif and b/resources/thechannel.gif differ diff --git a/resources/ui/ground_assets/aa.png b/resources/ui/ground_assets/aa.png index 171b5e4c..87d8a6ef 100644 Binary files a/resources/ui/ground_assets/aa.png and b/resources/ui/ground_assets/aa.png differ diff --git a/resources/ui/ground_assets/allycamp.png b/resources/ui/ground_assets/allycamp.png index 92b731af..a57564bc 100644 Binary files a/resources/ui/ground_assets/allycamp.png and b/resources/ui/ground_assets/allycamp.png differ diff --git a/resources/ui/ground_assets/ammo.png b/resources/ui/ground_assets/ammo.png index d28d296b..5f6a5a6a 100644 Binary files a/resources/ui/ground_assets/ammo.png and b/resources/ui/ground_assets/ammo.png differ diff --git a/resources/ui/ground_assets/comms.png b/resources/ui/ground_assets/comms.png index 9c0815dd..fc75eafc 100644 Binary files a/resources/ui/ground_assets/comms.png and b/resources/ui/ground_assets/comms.png differ diff --git a/resources/ui/ground_assets/derrick.png b/resources/ui/ground_assets/derrick.png index 5f2597bb..4317ff30 100644 Binary files a/resources/ui/ground_assets/derrick.png and b/resources/ui/ground_assets/derrick.png differ diff --git a/resources/ui/ground_assets/factory.png b/resources/ui/ground_assets/factory.png index 13d2b70e..427f0c61 100644 Binary files a/resources/ui/ground_assets/factory.png and b/resources/ui/ground_assets/factory.png differ diff --git a/resources/ui/ground_assets/farp.png b/resources/ui/ground_assets/farp.png index 359371c5..93614760 100644 Binary files a/resources/ui/ground_assets/farp.png and b/resources/ui/ground_assets/farp.png differ diff --git a/resources/ui/ground_assets/fob.png b/resources/ui/ground_assets/fob.png index 5fef4e8d..b651d7d7 100644 Binary files a/resources/ui/ground_assets/fob.png and b/resources/ui/ground_assets/fob.png differ diff --git a/resources/ui/ground_assets/fuel.png b/resources/ui/ground_assets/fuel.png index 89d20cfd..0210b9c3 100644 Binary files a/resources/ui/ground_assets/fuel.png and b/resources/ui/ground_assets/fuel.png differ diff --git a/resources/ui/ground_assets/oil.png b/resources/ui/ground_assets/oil.png index 6288bdfe..ea59b953 100644 Binary files a/resources/ui/ground_assets/oil.png and b/resources/ui/ground_assets/oil.png differ diff --git a/resources/ui/ground_assets/power.png b/resources/ui/ground_assets/power.png index 835f4512..203fcf76 100644 Binary files a/resources/ui/ground_assets/power.png and b/resources/ui/ground_assets/power.png differ diff --git a/resources/ui/ground_assets/ship.png b/resources/ui/ground_assets/ship.png index 534a99a4..097d01dc 100644 Binary files a/resources/ui/ground_assets/ship.png and b/resources/ui/ground_assets/ship.png differ diff --git a/resources/ui/ground_assets/target.png b/resources/ui/ground_assets/target.png index 251bafd4..91913868 100644 Binary files a/resources/ui/ground_assets/target.png and b/resources/ui/ground_assets/target.png differ diff --git a/resources/ui/ground_assets/village.png b/resources/ui/ground_assets/village.png index 0dcdb63b..599e532c 100644 Binary files a/resources/ui/ground_assets/village.png and b/resources/ui/ground_assets/village.png differ diff --git a/resources/ui/ground_assets/ware.png b/resources/ui/ground_assets/ware.png index 50ee2af3..eec7b0a0 100644 Binary files a/resources/ui/ground_assets/ware.png and b/resources/ui/ground_assets/ware.png differ diff --git a/resources/ui/ground_assets/ww2bunker.png b/resources/ui/ground_assets/ww2bunker.png index 5d029ae8..ced23ea0 100644 Binary files a/resources/ui/ground_assets/ww2bunker.png and b/resources/ui/ground_assets/ww2bunker.png differ diff --git a/resources/ui/misc/cheat.png b/resources/ui/misc/cheat.png index 9001790c..af0270cb 100644 Binary files a/resources/ui/misc/cheat.png and b/resources/ui/misc/cheat.png differ diff --git a/resources/ui/misc/icons-dark/cheat.png b/resources/ui/misc/dark/cheat.png similarity index 100% rename from resources/ui/misc/icons-dark/cheat.png rename to resources/ui/misc/dark/cheat.png diff --git a/resources/ui/misc/icons-dark/generator.png b/resources/ui/misc/dark/generator.png similarity index 100% rename from resources/ui/misc/icons-dark/generator.png rename to resources/ui/misc/dark/generator.png diff --git a/resources/ui/misc/icons-dark/hourglass.png b/resources/ui/misc/dark/hourglass.png similarity index 100% rename from resources/ui/misc/icons-dark/hourglass.png rename to resources/ui/misc/dark/hourglass.png diff --git a/resources/ui/misc/icons-dark/missile.png b/resources/ui/misc/dark/missile.png similarity index 100% rename from resources/ui/misc/icons-dark/missile.png rename to resources/ui/misc/dark/missile.png diff --git a/resources/ui/misc/icons-dark/money_icon.png b/resources/ui/misc/dark/money_icon.png similarity index 100% rename from resources/ui/misc/icons-dark/money_icon.png rename to resources/ui/misc/dark/money_icon.png diff --git a/resources/ui/misc/icons-dark/new.png b/resources/ui/misc/dark/new.png similarity index 100% rename from resources/ui/misc/icons-dark/new.png rename to resources/ui/misc/dark/new.png diff --git a/resources/ui/misc/icons-dark/open.png b/resources/ui/misc/dark/open.png similarity index 100% rename from resources/ui/misc/icons-dark/open.png rename to resources/ui/misc/dark/open.png diff --git a/resources/ui/misc/icons-dark/ordnance_icon.png b/resources/ui/misc/dark/ordnance_icon.png similarity index 100% rename from resources/ui/misc/icons-dark/ordnance_icon.png rename to resources/ui/misc/dark/ordnance_icon.png diff --git a/resources/ui/misc/icons-dark/proceed.png b/resources/ui/misc/dark/proceed.png similarity index 100% rename from resources/ui/misc/icons-dark/proceed.png rename to resources/ui/misc/dark/proceed.png diff --git a/resources/ui/misc/icons-dark/save.png b/resources/ui/misc/dark/save.png similarity index 100% rename from resources/ui/misc/icons-dark/save.png rename to resources/ui/misc/dark/save.png diff --git a/resources/ui/misc/icons-dark/settings.png b/resources/ui/misc/dark/settings.png similarity index 100% rename from resources/ui/misc/icons-dark/settings.png rename to resources/ui/misc/dark/settings.png diff --git a/resources/ui/misc/icons-dark/statistics.png b/resources/ui/misc/dark/statistics.png similarity index 100% rename from resources/ui/misc/icons-dark/statistics.png rename to resources/ui/misc/dark/statistics.png diff --git a/resources/ui/misc/generator.png b/resources/ui/misc/generator.png index 3a2971a9..d5ad0721 100644 Binary files a/resources/ui/misc/generator.png and b/resources/ui/misc/generator.png differ diff --git a/resources/ui/misc/hourglass.png b/resources/ui/misc/hourglass.png index d42e65b6..73745fc5 100644 Binary files a/resources/ui/misc/hourglass.png and b/resources/ui/misc/hourglass.png differ diff --git a/resources/ui/misc/icons-light/cheat.png b/resources/ui/misc/light/cheat.png similarity index 100% rename from resources/ui/misc/icons-light/cheat.png rename to resources/ui/misc/light/cheat.png diff --git a/resources/ui/misc/icons-light/generator.png b/resources/ui/misc/light/generator.png similarity index 100% rename from resources/ui/misc/icons-light/generator.png rename to resources/ui/misc/light/generator.png diff --git a/resources/ui/misc/icons-light/hourglass.png b/resources/ui/misc/light/hourglass.png similarity index 100% rename from resources/ui/misc/icons-light/hourglass.png rename to resources/ui/misc/light/hourglass.png diff --git a/resources/ui/misc/icons-light/missile.png b/resources/ui/misc/light/missile.png similarity index 100% rename from resources/ui/misc/icons-light/missile.png rename to resources/ui/misc/light/missile.png diff --git a/resources/ui/misc/icons-light/money_icon.png b/resources/ui/misc/light/money_icon.png similarity index 100% rename from resources/ui/misc/icons-light/money_icon.png rename to resources/ui/misc/light/money_icon.png diff --git a/resources/ui/misc/icons-light/new.png b/resources/ui/misc/light/new.png similarity index 100% rename from resources/ui/misc/icons-light/new.png rename to resources/ui/misc/light/new.png diff --git a/resources/ui/misc/icons-light/open.png b/resources/ui/misc/light/open.png similarity index 100% rename from resources/ui/misc/icons-light/open.png rename to resources/ui/misc/light/open.png diff --git a/resources/ui/misc/icons-light/ordnance_icon.png b/resources/ui/misc/light/ordnance_icon.png similarity index 100% rename from resources/ui/misc/icons-light/ordnance_icon.png rename to resources/ui/misc/light/ordnance_icon.png diff --git a/resources/ui/misc/icons-light/proceed.png b/resources/ui/misc/light/proceed.png similarity index 100% rename from resources/ui/misc/icons-light/proceed.png rename to resources/ui/misc/light/proceed.png diff --git a/resources/ui/misc/icons-light/save.png b/resources/ui/misc/light/save.png similarity index 100% rename from resources/ui/misc/icons-light/save.png rename to resources/ui/misc/light/save.png diff --git a/resources/ui/misc/icons-light/settings.png b/resources/ui/misc/light/settings.png similarity index 100% rename from resources/ui/misc/icons-light/settings.png rename to resources/ui/misc/light/settings.png diff --git a/resources/ui/misc/icons-light/statistics.png b/resources/ui/misc/light/statistics.png similarity index 100% rename from resources/ui/misc/icons-light/statistics.png rename to resources/ui/misc/light/statistics.png diff --git a/resources/ui/misc/icons-medium/cheat.png b/resources/ui/misc/medium/cheat.png similarity index 100% rename from resources/ui/misc/icons-medium/cheat.png rename to resources/ui/misc/medium/cheat.png diff --git a/resources/ui/misc/icons-medium/generator.png b/resources/ui/misc/medium/generator.png similarity index 100% rename from resources/ui/misc/icons-medium/generator.png rename to resources/ui/misc/medium/generator.png diff --git a/resources/ui/misc/icons-medium/hourglass.png b/resources/ui/misc/medium/hourglass.png similarity index 100% rename from resources/ui/misc/icons-medium/hourglass.png rename to resources/ui/misc/medium/hourglass.png diff --git a/resources/ui/misc/icons-medium/missile.png b/resources/ui/misc/medium/missile.png similarity index 100% rename from resources/ui/misc/icons-medium/missile.png rename to resources/ui/misc/medium/missile.png diff --git a/resources/ui/misc/icons-medium/money_icon.png b/resources/ui/misc/medium/money_icon.png similarity index 100% rename from resources/ui/misc/icons-medium/money_icon.png rename to resources/ui/misc/medium/money_icon.png diff --git a/resources/ui/misc/icons-medium/new.png b/resources/ui/misc/medium/new.png similarity index 100% rename from resources/ui/misc/icons-medium/new.png rename to resources/ui/misc/medium/new.png diff --git a/resources/ui/misc/icons-medium/open.png b/resources/ui/misc/medium/open.png similarity index 100% rename from resources/ui/misc/icons-medium/open.png rename to resources/ui/misc/medium/open.png diff --git a/resources/ui/misc/icons-medium/ordnance_icon.png b/resources/ui/misc/medium/ordnance_icon.png similarity index 100% rename from resources/ui/misc/icons-medium/ordnance_icon.png rename to resources/ui/misc/medium/ordnance_icon.png diff --git a/resources/ui/misc/icons-medium/proceed.png b/resources/ui/misc/medium/proceed.png similarity index 100% rename from resources/ui/misc/icons-medium/proceed.png rename to resources/ui/misc/medium/proceed.png diff --git a/resources/ui/misc/icons-medium/save.png b/resources/ui/misc/medium/save.png similarity index 100% rename from resources/ui/misc/icons-medium/save.png rename to resources/ui/misc/medium/save.png diff --git a/resources/ui/misc/icons-medium/settings.png b/resources/ui/misc/medium/settings.png similarity index 100% rename from resources/ui/misc/icons-medium/settings.png rename to resources/ui/misc/medium/settings.png diff --git a/resources/ui/misc/icons-medium/statistics.png b/resources/ui/misc/medium/statistics.png similarity index 100% rename from resources/ui/misc/icons-medium/statistics.png rename to resources/ui/misc/medium/statistics.png diff --git a/resources/ui/misc/missile.png b/resources/ui/misc/missile.png index 5fb0c691..086a43e7 100644 Binary files a/resources/ui/misc/missile.png and b/resources/ui/misc/missile.png differ diff --git a/resources/ui/misc/money_icon.png b/resources/ui/misc/money_icon.png index 0f81d4d2..dc626090 100644 Binary files a/resources/ui/misc/money_icon.png and b/resources/ui/misc/money_icon.png differ diff --git a/resources/ui/misc/new.png b/resources/ui/misc/new.png index 363509e2..3ff8a26c 100644 Binary files a/resources/ui/misc/new.png and b/resources/ui/misc/new.png differ diff --git a/resources/ui/misc/open.png b/resources/ui/misc/open.png index 5908bd44..97e15fdd 100644 Binary files a/resources/ui/misc/open.png and b/resources/ui/misc/open.png differ diff --git a/resources/ui/misc/ordnance_icon.png b/resources/ui/misc/ordnance_icon.png index ef40da1d..d9794c2c 100644 Binary files a/resources/ui/misc/ordnance_icon.png and b/resources/ui/misc/ordnance_icon.png differ diff --git a/resources/ui/misc/proceed.png b/resources/ui/misc/proceed.png index 3158786b..22c9b89d 100644 Binary files a/resources/ui/misc/proceed.png and b/resources/ui/misc/proceed.png differ diff --git a/resources/ui/misc/save.png b/resources/ui/misc/save.png index f6d4b63f..550b4963 100644 Binary files a/resources/ui/misc/save.png and b/resources/ui/misc/save.png differ diff --git a/resources/ui/misc/settings.png b/resources/ui/misc/settings.png index 7aa676ee..058808b8 100644 Binary files a/resources/ui/misc/settings.png and b/resources/ui/misc/settings.png differ diff --git a/resources/ui/misc/statistics.png b/resources/ui/misc/statistics.png index dba4e84c..731c69c7 100644 Binary files a/resources/ui/misc/statistics.png and b/resources/ui/misc/statistics.png differ diff --git a/resources/ui/splash_screen.png b/resources/ui/splash_screen.png index 68ff04ee..2b9e23c6 100644 Binary files a/resources/ui/splash_screen.png and b/resources/ui/splash_screen.png differ diff --git a/resources/ui/wizard/logo1.png b/resources/ui/wizard/logo1.png index 765e00bb..7aa676ee 100644 Binary files a/resources/ui/wizard/logo1.png and b/resources/ui/wizard/logo1.png differ diff --git a/resources/ui/wizard/original/logo1.png b/resources/ui/wizard/original/logo1.png new file mode 100644 index 00000000..765e00bb Binary files /dev/null and b/resources/ui/wizard/original/logo1.png differ diff --git a/userdata/liberation_theme.py b/userdata/liberation_theme.py new file mode 100644 index 00000000..703d15ee --- /dev/null +++ b/userdata/liberation_theme.py @@ -0,0 +1,74 @@ +import json +import os + +import qt_ui.uiconstants as CONST + +global __theme_index + +THEME_PREFERENCES_FILE_PATH = "liberation_theme.json" + +DEFAULT_THEME_INDEX = 1 + + +def init(): + global __theme_index + + __theme_index = DEFAULT_THEME_INDEX + print("init setting theme index to " + str(__theme_index)) + + if os.path.isfile(THEME_PREFERENCES_FILE_PATH): + try: + with(open(THEME_PREFERENCES_FILE_PATH)) as prefs: + pref_data = json.loads(prefs.read()) + __theme_index = pref_data["theme_index"] + print(__theme_index) + set_theme_index(__theme_index) + save_theme_config() + print("file setting theme index to " + str(__theme_index)) + except: + # is this necessary? + set_theme_index(DEFAULT_THEME_INDEX) + print("except setting theme index to " + str(__theme_index)) + else: + # is this necessary? + set_theme_index(DEFAULT_THEME_INDEX) + print("else setting theme index to " + str(__theme_index)) + + +# set theme index then use save_theme_config to save to file +def set_theme_index(x): + global __theme_index + __theme_index = x + + +# get theme index to reference other theme properties(themeName, themeFile, themeIcons) +def get_theme_index(): + global __theme_index + return __theme_index + + +# get theme name based on current index +def get_theme_name(): + theme_name = CONST.THEMES[get_theme_index()]['themeName'] + return theme_name + + +# get theme icon sub-folder name based on current index +def get_theme_icons(): + theme_icons = CONST.THEMES[get_theme_index()]['themeIcons'] + return str(theme_icons) + + +# get theme stylesheet css based on current index +def get_theme_css_file(): + theme_file = CONST.THEMES[get_theme_index()]['themeFile'] + return str(theme_file) + + +# save current theme index to json file +def save_theme_config(): + pref_data = { + "theme_index": get_theme_index() + } + with(open(THEME_PREFERENCES_FILE_PATH, "w")) as prefs: + prefs.write(json.dumps(pref_data))