Added display settings to the toolbar.

This commit is contained in:
Khopa 2020-12-03 22:48:28 +01:00
parent 72ac806cb8
commit 76840ff5c2
37 changed files with 65 additions and 8 deletions

View File

@ -230,7 +230,7 @@ class ControlPoint(MissionTarget, ABC):
self.stances: Dict[int, CombatStance] = {}
self.pending_unit_deliveries: Optional[UnitsDeliveryEvent] = None
self.target_position = None
self.target_position: Point = None
def __repr__(self):
return f"<{__class__}: {self.name}>"

View File

@ -50,7 +50,6 @@ class DisplayOptions:
ground_objects = DisplayRule("Ground Objects", True)
control_points = DisplayRule("Control Points", True)
lines = DisplayRule("Lines", True)
events = DisplayRule("Events", True)
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
detection_range = DisplayRule("SAM Detection Range", False)

View File

@ -78,6 +78,24 @@ def load_icons():
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["Discord"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/discord.png")
ICONS["Github"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/github.png")
ICONS["Control Points"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/circle.png")
ICONS["Ground Objects"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/industry.png")
ICONS["Lines"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/arrows-h.png")
ICONS["Waypoint Information"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/info.png")
ICONS["Map Polygon Debug Mode"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/map.png")
ICONS["Ally SAM Threat Range"] = QPixmap("./resources/ui/misc/blue-sam.png")
ICONS["Enemy SAM Threat Range"] = QPixmap("./resources/ui/misc/red-sam.png")
ICONS["SAM Detection Range"] = QPixmap("./resources/ui/misc/detection-sam.png")
ICONS["Display Culling Zones"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/eraser.png")
ICONS["Hide Flight Paths"] = QPixmap("./resources/ui/misc/hide-flight-path.png")
ICONS["Show Selected Flight Path"] = QPixmap("./resources/ui/misc/flight-path.png")
ICONS["Show All Flight Paths"] = QPixmap("./resources/ui/misc/all-flight-paths.png")
ICONS["Hangar"] = QPixmap("./resources/ui/misc/hangar.png")
ICONS["Terrain_Caucasus"] = QPixmap("./resources/ui/terrain_caucasus.gif")

View File

@ -52,8 +52,8 @@ class QLiberationWindow(QMainWindow):
self.initUi()
self.initActions()
self.initMenuBar()
self.initToolbar()
self.initMenuBar()
self.connectSignals()
screen = QDesktopWidget().screenGeometry()
@ -120,12 +120,27 @@ class QLiberationWindow(QMainWindow):
self.showLiberationPrefDialogAction.setIcon(QIcon.fromTheme("help-about"))
self.showLiberationPrefDialogAction.triggered.connect(self.showLiberationDialog)
self.openDiscordAction = QAction("&Discord Server", self)
self.openDiscordAction.setIcon(CONST.ICONS["Discord"])
self.openDiscordAction.triggered.connect(lambda: webbrowser.open_new_tab("https://" + "discord.gg" + "/" + "bKrt" + "rkJ"))
self.openGithubAction = QAction("&Github Repo", self)
self.openGithubAction.setIcon(CONST.ICONS["Github"])
self.openGithubAction.triggered.connect(lambda: webbrowser.open_new_tab("https://github.com/khopa/dcs_liberation"))
def initToolbar(self):
self.tool_bar = self.addToolBar("File")
self.tool_bar.addAction(self.newGameAction)
self.tool_bar.addAction(self.openAction)
self.tool_bar.addAction(self.saveGameAction)
self.links_bar = self.addToolBar("Links")
self.links_bar.addAction(self.openDiscordAction)
self.links_bar.addAction(self.openGithubAction)
self.display_bar = self.addToolBar("Display")
def initMenuBar(self):
self.menu = self.menuBar()
@ -145,20 +160,26 @@ class QLiberationWindow(QMainWindow):
last_was_group = True
for item in DisplayOptions.menu_items():
if isinstance(item, DisplayRule):
displayMenu.addAction(self.make_display_rule_action(item))
action = self.make_display_rule_action(item)
displayMenu.addAction(action)
if action.icon():
self.display_bar.addAction(action)
last_was_group = False
elif isinstance(item, DisplayGroup):
if not last_was_group:
displayMenu.addSeparator()
self.display_bar.addSeparator()
group = QActionGroup(displayMenu)
for display_rule in item:
displayMenu.addAction(
self.make_display_rule_action(display_rule, group))
action = self.make_display_rule_action(display_rule, group)
displayMenu.addAction(action)
if action.icon():
self.display_bar.addAction(action)
last_was_group = True
help_menu = self.menu.addMenu("&Help")
help_menu.addAction("&Discord Server", lambda: webbrowser.open_new_tab("https://" + "discord.gg" + "/" + "bKrt" + "rkJ"))
help_menu.addAction("&Github Repository", lambda: webbrowser.open_new_tab("https://github.com/khopa/dcs_liberation"))
help_menu.addAction(self.openDiscordAction)
help_menu.addAction(self.openGithubAction)
help_menu.addAction("&Releases", lambda: webbrowser.open_new_tab("https://github.com/Khopa/dcs_liberation/releases"))
help_menu.addAction("&Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]))
help_menu.addAction("&ED Forum Thread", lambda: webbrowser.open_new_tab(URLS["ForumThread"]))
@ -177,6 +198,10 @@ class QLiberationWindow(QMainWindow):
return closure
action = QAction(f"&{display_rule.menu_text}", group)
if display_rule.menu_text in CONST.ICONS.keys():
action.setIcon(CONST.ICONS[display_rule.menu_text])
action.setCheckable(True)
action.setChecked(display_rule.value)
action.toggled.connect(make_check_closure())

View File

@ -48,6 +48,21 @@ QMenuBar::item:pressed {
background: #1D2731;
}
QToolButton:checked {
border-color: #435466;
background: #14202B;
}
QToolButton:hover {
background: #536476;
}
QToolBar::separator {
background:white;
width:1px;
height:1px;
}
QMenu::item:selected {
background: #435466;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB