def _save_edit(self, game, game_list, edit_game_dialog, lib_window): log.info("Save edit called") self.steam_thread.quit() self.loading_thread.quit() new_genre = self.genre_entry.text().strip() new_rating_str = self.rating_entry.text().strip() new_rating = round(float(new_rating_str), 1) game.genre = new_genre game.rating = new_rating try: from UserFile import UserFile new_lib_file = UserFile() new_lib_file.create_library_file(game_list) log.info("Save edit successful") except Exception as e: log.info(LIBRARY_FILE_EXCEPTION) log.info(e) ErrorDialog(LIBRARY_FILE_EXCEPTION) try: from LibraryUI import LibraryUI LibraryUI(lib_window) edit_game_dialog.accept() except Exception as e: log.info(LIBRARY_UI_EXCEPTION) log.info(e) ErrorDialog(LIBRARY_UI_EXCEPTION)
def createInterface(self): WxPandaShell.createInterface(self) self.leftBarUpNB = wx.Notebook(self.leftBarUpPane, style=wx.NB_BOTTOM) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.leftBarUpNB, 1, wx.EXPAND) self.leftBarUpPane.SetSizer(sizer) self.libraryUI = LibraryUI(self.leftBarUpNB, -1, self.editor) self.leftBarUpNB.AddPage(self.libraryUI, 'Library') self.pandaObjUI = PandaObjUI(self.leftBarUpNB, -1) self.leftBarUpNB.AddPage(self.pandaObjUI, 'Panda Objects') self.storyObjUI = StoryObjUI(self.leftBarUpNB, -1, self.editor) self.leftBarUpNB.AddPage(self.storyObjUI, 'Story Objects') self.leftBarDownNB = wx.Notebook(self.leftBarDownPane) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.leftBarDownNB, 1, wx.EXPAND) self.leftBarDownPane.SetSizer(sizer) self.leftBarDownPane0 = wx.Panel(self.leftBarDownNB, -1) self.leftBarDownNB.AddPage(self.leftBarDownPane0, 'Scene Graph') self.leftBarDownPane1 = wx.Panel(self.leftBarDownNB, -1) self.leftBarDownNB.AddPage(self.leftBarDownPane1, 'Scene List') self.soundUI = SoundUI(self.leftBarDownNB, -1, self.editor) self.leftBarDownNB.AddPage(self.soundUI, 'Sound List') self.rightBarDownNB = wx.Notebook(self.rightBarDownPane) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.rightBarDownNB, 1, wx.EXPAND) self.rightBarDownPane.SetSizer(sizer) self.rightBarDownPane0 = wx.Panel(self.rightBarDownNB, -1) self.rightBarDownNB.AddPage(self.rightBarDownPane0, 'Layers') self.topView.SetDropTarget( PandaTextDropTarget(self.editor, self.topView)) self.frontView.SetDropTarget( PandaTextDropTarget(self.editor, self.frontView)) self.leftView.SetDropTarget( PandaTextDropTarget(self.editor, self.leftView)) self.perspView.SetDropTarget( PandaTextDropTarget(self.editor, self.perspView)) self.rightBarDownPane.Layout() self.Layout() self.baseFrame.SplitVertically(self.viewFrame, self.rightFrame, 500) self.objectPropertyUI = ObjectPropertyUI(self.rightBarUpPane, self.editor) self.sceneGraphUI = SceneGraphUI(self.leftBarDownPane0, self.editor) self.scenesUI = ScenesUI(self.leftBarDownPane1, self.editor) self.layerEditorUI = LayerEditorUI(self.rightBarDownPane0, self.editor) self.showGridMenuItem.Check(True)
def _on_finished(self, finished): log.info("On finished called") if finished: #Sorting the list alphabetically, omitting "the " or "The " from the beginning of titles self.game_list.sort(key = attrgetter("sort_name"), reverse = False) #basically just assigning the genres from the futures result to the actual games in the games_list for game in self.game_list: for genre in self.result_list: if genre.startswith(str(game.steam_app_id)): game.genre = genre.replace(str(game.steam_app_id), "") print("-----------------------------") end = time.time() print("Job end: " + str(end)) print("Job took: " + str(end - self.start)) log.info("Job end: " + str(end)) log.info("Job took: " + str(end - self.start)) print("-----------------------------") try: try: from UserFile import UserFile #saving user files once everything has been done successfully log.info("Saving user files") user_info_file = UserFile(self.steam_user) user_info_file.create_user_file() user_info_file.create_library_file(self.game_list) log.info("User files saved") except Exception as e: log.error(USER_FILE_EXCEPTION) log.error(e) ErrorDialog(USER_FILE_EXCEPTION) log.info("Loading LibraryUI") self.statusbar.clearMessage() self.last_increment_request.emit(True) self.steam_thread.quit() self.loading_thread.quit() LibraryUI(self.master) except Exception as e: log.error(LIBRARY_UI_EXCEPTION) log.error(e) ErrorDialog(LIBRARY_UI_EXCEPTION)
def main(): log.info("Driver main started") app = QtWidgets.QApplication(sys.argv) app.setWindowIcon(QIcon(WIN_ICON)) master = QtWidgets.QMainWindow() master.setWindowIcon(QIcon(WIN_ICON)) tray_icon = QtWidgets.QSystemTrayIcon(QtGui.QIcon(WIN_ICON), app) tray_icon.show() app_icon = QtGui.QIcon() app_icon.addFile(WIN_ICON, QtCore.QSize(256, 256)) myappid = "dharringtondev.GamingStatsProject" # arbitrary string ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) #if the files don't exist for user info and the game library, we're taking the user to put #their info in again if not os.path.exists(USER_FILE_NAME) and not os.path.exists( LIBRARY_FILE_NAME): try: log.info("Loading SteamUI") SteamUI(master) except Exception as e: log.error(STEAM_UI_EXCEPTION) log.error(e) ErrorDialog(STEAM_EXCEPTION) else: try: log.info("Loading LibraryUI") LibraryUI(master) except Exception as e: log.error(LIBRARY_UI_EXCEPTION) log.error(e) ErrorDialog(LIBRARY_UI_EXCEPTION) master.show() sys.exit(app.exec_())