def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.current_profileid = "" self.setupUi(self) self.logger = get_logger('desuratools', 'desuratools.log') self.logger.info('Logger Created') boldfont = QApplication.font() boldfont.setBold(True) self.addToSteam_action = self.action_factory("Add to Steam", self.add_to_steam) self.addToSteam_action.setFont(boldfont) self.installGame_action = self.action_factory("Install", self.install_game) self.installGame_action.setFont(boldfont) self.desuraPage_action = self.action_factory("View Profile", self.open_desura_page) self.uninstallGame_action = self.action_factory("Uninstall", self.uninstall_game) self.verifyGame_action = self.action_factory("Verify", self.verify_game) self.ownedGames_menu = QMenu(self) self.ownedGames_menu.addActions([ self.installGame_action, self.desuraPage_action ]) self.installedGames_menu = QMenu(self) self.installedGames_menu.addActions([ self.addToSteam_action, self.desuraPage_action, self.uninstallGame_action, self.verifyGame_action ]) self.selectAllButton.clicked.connect(self.select_all_games) self.desuraAccountName_verify.clicked.connect(self.populate_owned_games) self.installButton.clicked.connect(self.process_install_button) self.generateDesuraReport_action.activated.connect(self.generate_report) self.tabWidget.currentChanged.connect(self.swap_tabs) self.ownedGames_list.itemSelectionChanged.connect(self.update_gameinfo) self.installedGames_list.itemSelectionChanged.connect(self.update_gameinfo) self.refreshButton.clicked.connect(self.refresh_list) self.refreshLists_action.activated.connect(self.refresh_all) self.installedGames_list.customContextMenuRequested.connect(self.show_game_context) self.installedGames_list.doubleClicked.connect(self.add_to_steam) self.installedGames_list.setSelectionMode(QAbstractItemView.ExtendedSelection) self.ownedGames_list.setSelectionMode(QAbstractItemView.ExtendedSelection) self.steamID_input.addItems(steamutils.get_customurls_on_machine()) self.ownedGames_list.addItem("Verify your Desura username to see your owned games") QApplication.processEvents() self.loading_dialog = ProgressBarDialog() self.loading_dialog.show() QApplication.processEvents() self.populate_installed_games() self.load_data() self.loading_dialog.close() self.raise_()
def loadDefaults(self): """ Loads defaults settings of pysumo. """ self.setValue("configPath", pysumo.CONFIG_PATH) self.setValue("maxQueueSize", 10) self.setValue("maxUndoRedoQueueSize", 10) self.setValue("flushWriteQueuesTimeout", 10) self.setValue("logOutputPath", pysumo.CONFIG_PATH) self.setValue("socketOutputPath", pysumo.CONFIG_PATH) self.setValue("logLevel", 10) defFont = QApplication.font().family() defSize = QApplication.font().pointSize() self.setValue("keywordsFontFamily", defFont) self.setValue("keywordsFontSize", defSize) self.setValue("keywordsFontColor", QColor(Qt.darkGreen).name()) self.setValue("keywordsBoldStyle", True) self.setValue("keywordsItalicStyle", False) self.setValue("keywordsUnderlinedStyle", False) self.setValue("logicExprFontFamily", defFont) self.setValue("logicExprFontSize", defSize) self.setValue("logicExprFontColor", QColor(Qt.black).name()) self.setValue("logicExprBoldStyle", True) self.setValue("logicExprItalicStyle", False) self.setValue("logicExprUnderlinedStyle", False) self.setValue("commentFontFamily", defFont) self.setValue("commentFontSize", defSize) self.setValue("commentFontColor", QColor(Qt.darkMagenta).name()) self.setValue("commentBoldStyle", False) self.setValue("commentItalicStyle", True) self.setValue("commentUnderlinedStyle", False) self.setValue("stringsFontFamily", defFont) self.setValue("stringsFontSize", defSize) self.setValue("stringsFontColor", QColor(Qt.red).name()) self.setValue("stringsBoldStyle", False) self.setValue("stringsItalicStyle", False) self.setValue("stringsUnderlinedStyle", False) self.setValue("maxTextEditorWidgets", 10) self.setValue("maxDocumentationWidgets", 10) self.setValue("maxHierarchyWidgets", 10) self.setValue("maxGraphWidgets", 10) self.setValue("defaultFontSize", defSize) self.setValue("defaultFontFamily", defFont) self.setValue("defaultFontColor", QApplication.palette().text().color().name()) self.setValue("useHighlightingFontSize", False)
def sizeHint(self, option, index): size = QSqlRelationalDelegate.sizeHint(self, option, index) if index.isValid() and index.column() in self.__dates: value = QDate.fromString(index.model().data(index, Qt.DisplayRole), Qt.ISODate) value = value.toString(Qt.SystemLocaleLongDate) fm = QFontMetrics(QApplication.font()) return QSize(fm.width(value) + 5, size.height()) else: return size
from sys import argv, exit from PySide.QtGui import QApplication, QFont, QFontMetrics, QX11Info from mainwindow import MainWindow app = QApplication(argv) font = QFont(QApplication.font()) font.setPointSize(9) QApplication.setFont(font) w = MainWindow() metrics = QFontMetrics(font) w.resize(metrics.width('M') * 80, metrics.height() * 24) w.show() exit(app.exec_())
self.showOrHideSortAs() self.updateMode() if self.calcSortAsCheckBox.isChecked(): saf = self.saf if self.saf != Saf.CUSTOM else Saf.AUTO self.state.calculateSortAs(saf, force=True) else: self.saf = Saf.CUSTOM if __name__ == "__main__": import sys import unittest.mock app = QApplication(sys.argv) app.setOrganizationName("Qtrac Ltd.") app.setOrganizationDomain("qtrac.eu") app.setApplicationName("XindeX-Test") app.setApplicationVersion("1.0.0") class Window: pass window = Window() window.font = unittest.mock.MagicMock(return_value=app.font()) window.formatActions = unittest.mock.MagicMock() state = State.State(window) state.spellPanel = unittest.mock.MagicMock() state.spellPanel.clearSuggestions = unittest.mock.MagicMock() panel = Panel(state) panel.show() app.exec_()
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.current_profileid = "" self.setupUi(self) self.logger = get_logger('desuratools', 'desuratools.log') self.logger.info('Logger Created') boldfont = QApplication.font() boldfont.setBold(True) self.addToSteam_action = self.action_factory("Add to Steam", self.add_to_steam) self.addToSteam_action.setFont(boldfont) self.installGame_action = self.action_factory("Install", self.install_game) self.installGame_action.setFont(boldfont) self.desuraPage_action = self.action_factory("View Profile", self.open_desura_page) self.uninstallGame_action = self.action_factory( "Uninstall", self.uninstall_game) self.verifyGame_action = self.action_factory("Verify", self.verify_game) self.ownedGames_menu = QMenu(self) self.ownedGames_menu.addActions( [self.installGame_action, self.desuraPage_action]) self.installedGames_menu = QMenu(self) self.installedGames_menu.addActions([ self.addToSteam_action, self.desuraPage_action, self.uninstallGame_action, self.verifyGame_action ]) self.selectAllButton.clicked.connect(self.select_all_games) self.desuraAccountName_verify.clicked.connect( self.populate_owned_games) self.installButton.clicked.connect(self.process_install_button) self.generateDesuraReport_action.activated.connect( self.generate_report) self.tabWidget.currentChanged.connect(self.swap_tabs) self.ownedGames_list.itemSelectionChanged.connect(self.update_gameinfo) self.installedGames_list.itemSelectionChanged.connect( self.update_gameinfo) self.refreshButton.clicked.connect(self.refresh_list) self.refreshLists_action.activated.connect(self.refresh_all) self.installedGames_list.customContextMenuRequested.connect( self.show_game_context) self.installedGames_list.doubleClicked.connect(self.add_to_steam) self.installedGames_list.setSelectionMode( QAbstractItemView.ExtendedSelection) self.ownedGames_list.setSelectionMode( QAbstractItemView.ExtendedSelection) self.steamID_input.addItems(steamutils.get_customurls_on_machine()) self.ownedGames_list.addItem( "Verify your Desura username to see your owned games") QApplication.processEvents() self.loading_dialog = ProgressBarDialog() self.loading_dialog.show() QApplication.processEvents() self.populate_installed_games() self.load_data() self.loading_dialog.close() self.raise_()