66 raise Exception ("Must be using Python 3.4 or up" )
77# QT Imports
88try :
9- from PyQt5 .QtWidgets import QApplication , QWidget , QPushButton , QVBoxLayout , QHBoxLayout , QLabel , QFileDialog , QGroupBox , QMessageBox , QComboBox , QScrollArea , QSizePolicy , QTabWidget , QLineEdit
9+ from PyQt5 .QtWidgets import QApplication , QWidget , QPushButton , QVBoxLayout , QHBoxLayout , QLabel , QFileDialog , QGroupBox , QMessageBox , QComboBox , QScrollArea , QSizePolicy , QTabWidget , QLineEdit , QStatusBar
1010 from PyQt5 .QtGui import QDoubleValidator , QRegExpValidator
1111 from PyQt5 .QtCore import QRegExp , Qt
1212 from functools import partial
1919# local imports
2020from asbuilt import AsBuilt
2121from encoder import print_bits_known_de07_08 , ItemEncoder , print_duplicates
22- from statics import JumpTables , Fields
22+ from statics import JumpTables , Fields , ThemeConfig
2323# global imports
2424import argparse
2525
@@ -143,11 +143,15 @@ def launch_picker(self):
143143 self .button_save_as = QPushButton ("Save as ..." ) if self .button_save_as is None else self .button_save_as
144144 self .button_save_as .clicked .connect (self .save_file_as )
145145 self .button_save .clicked .connect (self .save )
146+ self .syncversion = QComboBox ()
147+ self .syncversion .addItems (["3.0-3.2" , "3.4" ])
148+ self .syncversion .setCurrentIndex (1 )
146149
147150 self .button_group_layout .addWidget (self .button_open )
148151 self .button_group_layout .addWidget (self .button_save )
149152 self .button_group_layout .addWidget (self .button_save_as )
150153 self .button_group_layout .addWidget (self .button_exit )
154+ self .button_group_layout .addWidget (self .syncversion )
151155 self .button_group .setLayout (self .button_group_layout )
152156
153157 ## Block group
@@ -231,7 +235,7 @@ def launch_picker(self):
231235 setup_layout .addWidget (scroll_area )
232236 setup .setLayout (setup_layout )
233237
234- items = self .encoder .QtItemList (x , self .asbuilt , self .textblocks [x - 1 ])
238+ items = self .encoder .QtItemList (x , self .asbuilt , self .textblocks [x - 1 ], self . themechange )
235239 for item in items :
236240 block_items_layout .addLayout (item )
237241 self .tab .append (setup )
@@ -249,8 +253,26 @@ def launch_picker(self):
249253 self .picker_window .setLayout (self .picker_layout )
250254 self .current_window = self .picker_window
251255 #self.picker_window.setSizePolicy(QSizePolicy.Expanding)
256+ self .statusBar = QStatusBar ()
257+ self .picker_layout .addWidget (self .statusBar )
258+ self .statusBar .showMessage ("" )
252259 self .picker_window .show ()
253260
261+ def themechange (self ):
262+
263+ animation = int (self .textblocks [1 ][2 ].text (), 16 )
264+ theme = int (self .textblocks [2 ][2 ].text (), 16 )
265+ brand = (int (self .textblocks [0 ][5 ].text (), 16 ) & 0b11100000 ) >> 5
266+
267+ #print(theme, animation, brand, self.syncversion.currentText())
268+ matches = ThemeConfig .validate (brand , theme , animation , version = self .syncversion .currentText ())
269+
270+ message = "No themes found matching configuration!" if len (matches ) == 0 else matches [0 ] if len (matches ) == 1 else "Found %d themes: %s" % (len (matches ), "" .join (matches ))
271+ self .statusBar .showMessage (message )
272+ #print(matches)
273+ #f = ThemeConfig.validate()
274+
275+
254276 def launch_qt (self ):
255277 self .app = QApplication ([])
256278 self .app .setStyle ('Fusion' )
@@ -263,6 +285,7 @@ def launch_qt(self):
263285 self .button_exit = QPushButton ("Exit" )
264286 self .button_exit .clicked .connect (sys .exit )
265287
288+
266289 self .main_layout .addWidget (self .button_open )
267290 self .main_layout .addWidget (self .button_exit )
268291
0 commit comments