Skip to content

Commit

Permalink
Styling of app single CSS sheet, renaming of various widget objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexeh committed Feb 26, 2024
1 parent 3d93bd6 commit 9dffa06
Show file tree
Hide file tree
Showing 16 changed files with 581 additions and 294 deletions.
218 changes: 218 additions & 0 deletions joystick_diagrams/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
/*
Test Comment
*/

QMainWindow {{
background: #120303;
}}

QWidget {{
background: #120303
}}

/* Main Navigation */

.pill-button.discord {{
background: #7289da;
color:white
}}

.pill-button.discord::icon {{
color: black;
}}
.pill-button{{
max-height: 25px;
max-width: 70px;
font-size: 10px;
background: #D8DBE2;
border: none;
color: black;
opacity: 0.5;
}}

.pill-button:hover{{
background: #A9BCD0;
}}

.nav-button.right {{
border-top-right-radius: 10px;
border-top-left-radius: 0px;
border-bottom-left-radius: 0px
}}

.nav-button.left {{
border-top-left-radius: 10px;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 5px;
}}

.nav-button.middle {{
border-radius: 0px;
}}

.nav-button {{
color: #120303;
background-color: #D8DBE2;
border: none;
padding: 25px;
max-height: 15px
}}

.nav-button:checked {{
color: white;
background-color: #255F85;
border-bottom: 2px solid #A9BCD0;
}}

.nav-button:hover:checked {{
color: white;
background-color: #255F85;
}}

.nav-button:hover {{
color: #120303;
background-color: #A9BCD0;
}}

/* Plugin Setup CSS */

#heading_label {{
color:#D8DBE2;
font-size: 300px;
}}

#pluginTreeHelpLabel {{
color:#D8DBE2;
}}

.run-button {{
padding: 25px;
}}

.run-button.enabled {{
background: #255F85;
color:white;
}}

.run-button.disabled {{
background: #C5283D;
color: white;
}}

.enabled-wrapper {{
background:#D8DBE2;
}}

.enabled-button {{
padding: 5px;
background: #C5283D;
color: white;
border: none;
}}

.enabled-button:checked {{
background: #255F85
}}

.ready-button {{
background:#D8DBE2;
}}

.ready-button:hover {{
background:#D8DBE2;
}}

.plugin-setup-button {{
background: #C5283D;
color:white
}}
QTreeWidget.plugin-tree {{
color: black;
background-color: #D8DBE2;
padding: 20px;
}}

QTreeWidget.plugin-tree::item:hover {{
background-color: #D8DBE2;
}}

QTreeWidget.plugin-tree::item {{
color: #120303;
background-color: #D8DBE2;
}}

QTreeWidget.plugin-tree QHeaderView::section {{
font-size: 12pt;
color: #2d3436;
background-color: #D8DBE2;
}}

/* Configure Page CSS */

/* Tab Controls */



.configure-tabwidget QTabBar::tab {{
padding:10px;
color: #120303;
background-color: #D8DBE2;
border-right:1px solid black;
}}

.configure-tabwidget QTabBar::tab:selected {{
border-bottom: 2px solid white;
background: #255F85;
color: white;
}}

.configure-tabwidget QTabBar::tab:first {{
border-top-left-radius: 5px;
}}

.configure-tabwidget QTabBar::tab:last {{
border-top-right-radius: 5px;
}}

/* Drop Down List */

QComboBox.view-binds-list {{
background: #29468a;
padding: 10px;
}}

QComboBox::item.view-binds-list {{
color: black;
}}


/* Tree Widget */

QTreeWidget .view-binds-tree {{
color: white;
background-color: #D8DBE2;
padding: 20px;
}}

QTreeWidget::item .view-binds-tree {{
color: #120303;
background-color: #D8DBE2;
border-top-color: transparent;
border-bottom-color: transparent;
}}

QTreeView::branch:closed:has-children:has-siblings {{
border-image: none;
background: #D8DBE2;
}}

QTreeWidget QHeaderView::section .view-binds-tree {{
font-size: 12pt;
color: #2d3436;
background-color: #D8DBE2;
}}

QTreeWidget.view-binds-tree::branch {{
background-color: #D8DBE2;
}}
58 changes: 33 additions & 25 deletions joystick_diagrams/ui/configure_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,34 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setupUi(self)
self.appState = AppState()
self.treeWidget.header().setVisible(True)
self.treeWidget.header().setStretchLastSection(True)
self.treeWidget.header().setSectionResizeMode(
self.viewBindsTreeWidget.header().setVisible(True)
self.viewBindsTreeWidget.header().setStretchLastSection(True)
self.viewBindsTreeWidget.header().setSectionResizeMode(
QHeaderView.ResizeMode.ResizeToContents
)

self.treeWidget.setSelectionBehavior(
self.viewBindsTreeWidget.setSelectionBehavior(
QAbstractItemView.SelectionBehavior.SelectRows
)
self.treeWidget.setSelectionMode(
self.viewBindsTreeWidget.setSelectionMode(
QAbstractItemView.SelectionMode.SingleSelection
)
self.treeWidget.sortByColumn(0, Qt.SortOrder.AscendingOrder)
self.viewBindsTreeWidget.sortByColumn(0, Qt.SortOrder.AscendingOrder)

self.profileParentWidget = parent_profiles.parent_profile_ui()
self.verticalLayout_6.addWidget(self.profileParentWidget)
self.profileList.clicked.connect(self.handle_clicked_profile)
self.profileList.setDragEnabled(False)

self.comboBox.currentIndexChanged.connect(self.load_binds_for_selected_profile)
self.viewBindsProfileList.currentIndexChanged.connect(
self.load_binds_for_selected_profile
)

self.tabWidget.setProperty("class", "configure-tabwidget")
self.viewBindsTreeWidget.setProperty("class", "view-binds-tree")
self.viewBindsProfileList.setProperty("class", "view-binds-list")

self.viewBindsProfileList.setIconSize(QSize(25, 25))

# UI Setup
self.device_header = QTreeWidgetItem()
Expand All @@ -57,19 +65,19 @@ def __init__(self, *args, **kwargs):
self.device_header.setText(1, "Action")
self.device_header.setSizeHint(1, QSize(150, 25))

self.treeWidget.setHeaderItem(self.device_header)
self.treeWidget.setIconSize(QSize(20, 20))
self.treeWidget.setWordWrap(False)
self.treeWidget.setColumnCount(2)
self.treeWidget.header().setMinimumSectionSize(200)
self.treeWidget.header().setStretchLastSection(True)
self.treeWidget.header().setSectionResizeMode(
self.viewBindsTreeWidget.setHeaderItem(self.device_header)
self.viewBindsTreeWidget.setIconSize(QSize(20, 20))
self.viewBindsTreeWidget.setWordWrap(False)
self.viewBindsTreeWidget.setColumnCount(2)
self.viewBindsTreeWidget.header().setMinimumSectionSize(200)
self.viewBindsTreeWidget.header().setStretchLastSection(True)
self.viewBindsTreeWidget.header().setSectionResizeMode(
QHeaderView.ResizeMode.ResizeToContents
)
self.treeWidget.setSelectionBehavior(
self.viewBindsTreeWidget.setSelectionBehavior(
QAbstractItemView.SelectionBehavior.SelectRows
)
self.treeWidget.setSelectionMode(
self.viewBindsTreeWidget.setSelectionMode(
QAbstractItemView.SelectionMode.SingleSelection
)

Expand Down Expand Up @@ -97,17 +105,17 @@ def initialise_available_profiles(self):

def initialise_customise_binds(self):
profile_wrappers = self.appState.profile_wrappers
self.treeWidget.clear()
self.comboBox.clear()
self.viewBindsTreeWidget.clear()
self.viewBindsProfileList.clear()

for profile in profile_wrappers:
self.comboBox.addItem(
self.viewBindsProfileList.addItem(
QIcon(profile.profile_origin.icon),
profile.profile_name,
profile,
)

self.comboBox.setCurrentIndex(0)
self.viewBindsProfileList.setCurrentIndex(0)

def create_control_type_widget(self, control: Axis | Button | Hat | AxisSlider):
if isinstance(control, Axis):
Expand Down Expand Up @@ -147,14 +155,14 @@ def load_binds_for_selected_profile(self, index):
# If box has been emptied due to profile load
return

selected_profile: ProfileWrapper = self.comboBox.currentData()
selected_profile: ProfileWrapper = self.viewBindsProfileList.currentData()

self.treeWidget.clear()
self.viewBindsTreeWidget.clear()

profile_data = selected_profile.profile

for device_obj in profile_data.get_devices().values():
device_root = QTreeWidgetItem(self.treeWidget)
device_root = QTreeWidgetItem(self.viewBindsTreeWidget)

device_root.setText(0, device_obj.name)
device_root.setIcon(0, self.device_icon)
Expand All @@ -178,15 +186,15 @@ def load_binds_for_selected_profile(self, index):
)
control_widget.setText(input_obj.input_control.identifier)

self.treeWidget.setItemWidget(input_node, 0, control_widget)
self.viewBindsTreeWidget.setItemWidget(input_node, 0, control_widget)

for modifier_obj in input_obj.modifiers:
modifier_node = QTreeWidgetItem(input_node)

modifier_node.setText(0, str(modifier_obj.modifiers))
modifier_node.setText(1, modifier_obj.command)

self.treeWidget.addTopLevelItem(device_root)
self.viewBindsTreeWidget.addTopLevelItem(device_root)

@Slot()
def handle_clicked_profile(self, item):
Expand Down
4 changes: 2 additions & 2 deletions joystick_diagrams/ui/device_setup_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def setup_export_devices(export_device_list: list[ExportDevice]):
# Get the template
try:
export_device.template = get_template_for_device(export_device.device_id)
except JoystickDiagramsError:
_logger.error("Attempted to get a template that no longer exists")
except JoystickDiagramsError as e:
_logger.error(e)


def get_export_devices() -> list[ExportDevice]:
Expand Down
22 changes: 15 additions & 7 deletions joystick_diagrams/ui/export_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ def __init__(self, *args, **kwargs):
# Include Device setup Widget
self.device_widget = DeviceSetup()
self.device_widget.device_item_selected.connect(self.change_template_button)
self.horizontalLayout.addWidget(self.device_widget)
self.devices_container.addWidget(self.device_widget)
self.device_widget.number_of_selected_profiles.connect(
self.update_export_button_state
)

self.device_header_label.setText("Devices")
self.device_help_label.setText(
"Choose your devices or profiles to export below"
)

## Include Export Settings Panel
self.export_settings_widget = ExportSettings()
self.export_settings_container.addWidget(self.export_settings_widget)
Expand Down Expand Up @@ -132,13 +137,16 @@ def export_finished(self, data):
# TODO handle MW interaction better
main_window_inst: main_window = self.appState.main_window
main_window_inst.statusLabel.setText("Waiting...")
QMessageBox.information(
self,
"Items exported",
f"{data} items were exported to {self.export_settings_widget.export_location}",
buttons=QMessageBox.StandardButton.Ok,
defaultButton=QMessageBox.StandardButton.Ok,

msg_box = QMessageBox()
msg_box.setWindowFlags(Qt.WindowType.FramelessWindowHint)
msg_box.setText(
f"{data} items were exported to {self.export_settings_widget.export_location}"
)
msg_box.setDefaultButton(QMessageBox.StandardButton.Ok)
msg_box.setStandardButtons(QMessageBox.StandardButton.Ok)

msg_box.exec()
webbrowser.open(self.export_settings_widget.export_location)

def update_export_progress(self, data):
Expand Down
Loading

0 comments on commit 9dffa06

Please sign in to comment.