Skip to content

Commit

Permalink
Merge pull request #57 from dmg210/main
Browse files Browse the repository at this point in the history
add dark theme support for windows
enable gui to run without a serial device
append amd64 to the file name
add dark theme support for linux
upscale icon for ubuntu
  • Loading branch information
dmg210 authored Nov 24, 2024
2 parents 6a6ba88 + 72d7643 commit 790e502
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Build MSI Package
run: |
candle .github/workflows/dialog.wxs .github/workflows/ui.wxs .github/workflows/product.wxs -dversion="${{env.version}}"
light -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -out ./GKFlasher-${{env.version}}.msi ./dialog.wixobj ./ui.wixobj ./product.wixobj
light -ext WixUIExtension -ext WixUtilExtension -sacl -spdb -out ./GKFlasher-${{env.version}}-amd64.msi ./dialog.wixobj ./ui.wixobj ./product.wixobj
- name: Upload MSI to Releases
uses: "marvinpinto/action-automatic-releases@latest"
Expand All @@ -56,4 +56,4 @@ jobs:
prerelease: false
title: ${{env.version}}
files: |
GKFlasher-${{env.version}}.msi
GKFlasher-${{env.version}}-amd64.msi
29 changes: 15 additions & 14 deletions .github/workflows/product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,46 @@
<File Id="ApplicationFile26" Source="flasher\checksum.py" />
<File Id="ApplicationFile27" Source="flasher\ecu.py" />
<File Id="ApplicationFile28" Source="flasher\gkflasher.ui" />
<File Id="ApplicationFile29" Source="flasher\immo.py" />
<File Id="ApplicationFile30" Source="flasher\logging.py" />
<File Id="ApplicationFile31" Source="flasher\memory.py" />
<File Id="ApplicationFile29" Source="flasher\gkflasher.qss" />
<File Id="ApplicationFile30" Source="flasher\immo.py" />
<File Id="ApplicationFile31" Source="flasher\logging.py" />
<File Id="ApplicationFile32" Source="flasher\memory.py" />
</Component>
</Directory>
<Directory Id="ASSETSDIR" Name="assets">
<Component Id="ApplicationFilesC" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE7}">
<File Id="ApplicationFile32" Source="assets\Siemens_T_Logo.ico" />
<File Id="ApplicationFile33" Source="assets\Siemens_T_Logo.ico" />
</Component>
</Directory>
<Directory Id="PYQT5DIR" Name="PyQt5">
<Component Id="ApplicationFilesD" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE6}">
<File Id="ApplicationFile33" Source="dist\gui\PyQt5\QtCore.pyd" />
<File Id="ApplicationFile34" Source="dist\gui\PyQt5\QtGui.pyd" />
<File Id="ApplicationFile35" Source="dist\gui\PyQt5\QtWidgets.pyd" />
<File Id="ApplicationFile36" Source="dist\gui\PyQt5\sip.cp312-win_amd64.pyd" />
<File Id="ApplicationFile34" Source="dist\gui\PyQt5\QtCore.pyd" />
<File Id="ApplicationFile35" Source="dist\gui\PyQt5\QtGui.pyd" />
<File Id="ApplicationFile36" Source="dist\gui\PyQt5\QtWidgets.pyd" />
<File Id="ApplicationFile37" Source="dist\gui\PyQt5\sip.cp312-win_amd64.pyd" />
</Component>
<Directory Id="QT5DIR" Name="Qt5">
<Directory Id="PYQT5BINDIR" Name="bin">
<Component Id="ApplicationFilesE" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE5}">
<File Id="ApplicationFile37" Source="dist\gui\PyQt5\Qt5\bin\Qt5Core.dll" />
<File Id="ApplicationFile38" Source="dist\gui\PyQt5\Qt5\bin\Qt5Gui.dll" />
<File Id="ApplicationFile39" Source="dist\gui\PyQt5\Qt5\bin\Qt5Widgets.dll" />
<File Id="ApplicationFile38" Source="dist\gui\PyQt5\Qt5\bin\Qt5Core.dll" />
<File Id="ApplicationFile39" Source="dist\gui\PyQt5\Qt5\bin\Qt5Gui.dll" />
<File Id="ApplicationFile40" Source="dist\gui\PyQt5\Qt5\bin\Qt5Widgets.dll" />
</Component>
</Directory>
<Directory Id="PYQT5PLUGINSDIR" Name="plugins">
<Directory Id="PLATFORMDIR" Name="platforms">
<Component Id="ApplicationFilesF" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE4}">
<File Id="ApplicationFile40" Source="dist\gui\PyQt5\Qt5\plugins\platforms\qwindows.dll" />
<File Id="ApplicationFile41" Source="dist\gui\PyQt5\Qt5\plugins\platforms\qwindows.dll" />
</Component>
</Directory>
<Directory Id="STYLESDIR" Name="styles">
<Component Id="ApplicationFilesG" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE3}">
<File Id="ApplicationFile41" Source="dist\gui\PyQt5\Qt5\plugins\styles\qwindowsvistastyle.dll" />
<File Id="ApplicationFile42" Source="dist\gui\PyQt5\Qt5\plugins\styles\qwindowsvistastyle.dll" />
</Component>
</Directory>
<Directory Id="IMAGEFORMATSDIR" Name="imageformats">
<Component Id="ApplicationFilesH" Guid="{652E355F-4E96-40FB-8B34-A9593CE42CE2}">
<File Id="ApplicationFile42" Source="dist\gui\PyQt5\Qt5\plugins\imageformats\qico.dll" />
<File Id="ApplicationFile43" Source="dist\gui\PyQt5\Qt5\plugins\imageformats\qico.dll" />
</Component>
</Directory>
</Directory>
Expand Down
Binary file modified assets/Siemens_T_Logo.ico
Binary file not shown.
211 changes: 211 additions & 0 deletions flasher/gkflasher.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/* General Styling */
QMainWindow {
background-color: #2c3e50; /* Dark gray background */
color: #ecf0f1; /* Light text */
}

/* Buttons */
QPushButton {
background-color: #206999; /* Blue button */
color: #ecf0f1; /* White text */
border-radius: 8px; /* Rounded corners */
padding: 1px 1px;
border: none;
font-family: "Lato";
font-size: 11px;
}
QPushButton:hover {
background-color: #2d81ba; /* Lighter blue on hover */
}

/* General styling for QComboBox (drop down menu - not selected) */
QComboBox {
background-color: #34495e; /* Dark background */
color: #ecf0f1; /* Light text color */
padding: 4px;
}

/* Styling for all dropdown menus */
QComboBox QAbstractItemView {
background-color: #425b75; /* Slightly darker dropdown background */
color: #ecf0f1; /* Light text color */
border: 1px solid #34495e;
selection-background-color: #3498db; /* Highlighted item */
selection-color: #ffffff; /* Text color for highlighted item */
}

/* Styling for interfacesBox when not clicked */
#interfacesBox {
background-color: #4c6b8a;
border: 1px solid #658396;
font-family: "Lato";
font-size: 11px;
}

/* Styling for ecusBox when not clicked */
#ecusBox {
background-color: #4c6b8a;
border: 1px solid #658396;
font-family: "Lato";
font-size: 11px;
}

/* Styling for baudratesBox when not clicked */
#baudratesBox {
background-color: #4c6b8a;
border: 1px solid #658396;
font-family: "Lato";
font-size: 11px;
}

/* Text boxes */
QLineEdit {
border: 1px solid #2980b9;
border-radius: 5px;
padding: 1px;
color: #2c3e50;
background-color: #ecf0f1;
}

/* Labels (Popup Message Boxes) */
QLabel {
font-size: 14px;
font-weight: bold;
}

/* Progress Bar */
QProgressBar {
border: 1px solid #34495e;
border-radius: 5px;
text-align: center;
color: #ecf0f1;
background-color: #34495e;
}
QProgressBar::chunk {
background-color: #2ecc71; /* Green progress bar */
border-radius: 5px;
}

/* logOutput Styling */
#logOutput {
background-color: #2c3e50;
color: #ecf0f1;
font-family: "Consolas";
font-size: 12px;
border-radius: 5px;
border: 1px solid #34495e;
}

/* About Box - Note: Font set in gkflasher.ui HTML */
QTextBrowser {
background-color: rgba(44, 62, 80, 0.8); /* Dark transparent background (80% opacity) */
background-image: url("assets/Siemens_T_Logo.ico");
background-repeat: no-repeat;
background-position: right;
color: #ecf0f1;
border: none;
}

/* QTabWidget Styling (bottom box)*/
QTabWidget::pane {
background-color: #2c3e50;
border: 1px solid #34495e;
border-radius: 5px;
}

QTabBar::tab {
background: #34495e;
color: #ecf0f1;
padding: 6px 12px;
border: 1px solid #2c3e50;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-family: "Lato";
font-size: 11px;
}

QTabBar::tab:hover {
background: #3b5998; /* Slightly lighter background on hover */
}

QTabBar::tab:selected {
background-color: #2ecc71; /* green buttons */
color: #0f3d0f; /* dark green text */
}

QTabBar::tab:disabled {
background: #7f8c8d;
color: #bdc3c7;
}

/* QMessageBox Styling */
QMessageBox {
background-color: #2c3e50; /* Dark background */
}

/* QMessageBox Buttons */
QMessageBox QPushButton {
background-color: #2980b9; /* Blue button background */
color: #ffffff; /* White button text */
border-radius: 5px; /* Rounded corners */
padding: 6px 12px; /* Padding inside buttons */
border: 1px solid #1f618d;
}

QMessageBox QPushButton:hover {
background-color: #3498db; /* Lighter blue on hover */
}

QMessageBox QPushButton:pressed {
background-color: #1f618d; /* Darker blue when pressed */
}

QMessageBox QLabel {
color: #ecf0f1; /* Ensures the message text inherits the correct color */
}
QMessageBox QPushButton {
background-color: #2980b9;
}

/* General QInputDialog Styling, e.g. Enter pin number boxes. This is different to yes/no prompts */
QInputDialog {
background-color: #2c3e50; /* Dark background */
border: 1px solid #34495e; /* Subtle border */
border-radius: 8px; /* Rounded corners */
color: #ecf0f1; /* Light text color */
}

/* QLabel Styling (for dialog text) */
QInputDialog QLabel {
color: #ecf0f1; /* Ensure label text is readable */
font-family: "Lato";
font-size: 14px;
}

/* QLineEdit Styling (for input field) */
QInputDialog QLineEdit {
background-color: #34495e; /* Slightly lighter background */
color: #ffffff; /* Input text color */
border: 1px solid #2ecc71; /* Green border */
border-radius: 5px; /* Rounded corners */
padding: 4px;
font-family: "Courier New", monospace; /* Monospace font for PIN input */
font-size: 15px; /* Slightly larger font size */
}

/* QPushButton Styling (for OK/Cancel buttons) */
QInputDialog QPushButton {
background-color: #2980b9; /* Blue buttons */
color: #ffffff; /* White button text */
border: none;
border-radius: 4px;
padding: 6px 12px;
}

QInputDialog QPushButton:hover {
background-color: #3498db; /* Lighter blue on hover */
}

QInputDialog QPushButton:pressed {
background-color: #1f618d; /* Darker blue on press */
}
24 changes: 15 additions & 9 deletions flasher/gkflasher.ui
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<width>781</width>
<height>138</height>
</rect>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt;&quot;&gt;https://opengk.org&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'System Font'; font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;https://opengk.com&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt;&quot;&gt;Created by:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt; font-weight:696;&quot;&gt;dante383&lt;/span&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt;&quot;&gt; https://github.com/dante383&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt; font-weight:696;&quot;&gt;dmg210&lt;/span&gt;&lt;span style=&quot; font-family:'System Font'; font-size:10pt;&quot;&gt; https://github.com/dmg210&lt;/span&gt;&lt;/p&gt;
Expand All @@ -408,15 +414,15 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
<property name="currentText">
<string>Interface</string>
<string>[!] No serial interfaces found.</string>
</property>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>791</width>
<width>781</width>
<height>23</height>
</rect>
</property>
Expand All @@ -437,9 +443,9 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="ecusBox">
<property name="geometry">
<rect>
<x>490</x>
<x>530</x>
<y>10</y>
<width>301</width>
<width>261</width>
<height>23</height>
</rect>
</property>
Expand All @@ -453,9 +459,9 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="baudratesBox">
<property name="geometry">
<rect>
<x>490</x>
<x>530</x>
<y>40</y>
<width>301</width>
<width>261</width>
<height>23</height>
</rect>
</property>
Expand Down
8 changes: 7 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def load_ui(self):
self.detect_interfaces()
except ValueError:
print('[!] No serial interfaces found!')
sys.exit(1)
return

self.load_ecus()
self.load_baudrates()
Expand Down Expand Up @@ -1134,5 +1134,11 @@ def continue_write_vin(self, vin, log_callback, ecu):

if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
stylesheet_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'flasher', 'gkflasher.qss')
if os.path.exists(stylesheet_path):
with open(stylesheet_path, "r") as stylesheet:
app.setStyleSheet(stylesheet.read())
else:
print(f"Stylesheet not found at {stylesheet_path}")
window = Ui()
sys.exit(app.exec_())

0 comments on commit 790e502

Please sign in to comment.