def winmain(): ''' Initialise common settings and check the operating environment before starting the application. ''' progheader() # import the locale, and set the locale. This is used for # locale-aware number to string formatting locale.setlocale(locale.LC_ALL, '') from PySide import QtGui app = QtGui.QApplication(sys.argv) # Set the default organisation name and application name used to store application settings app.setOrganizationDomain(info.ORGANISATION_DOMAIN) app.setOrganizationName(info.ORGANISATION_NAME) app.setApplicationName(info.APPLICATION_NAME) app.setApplicationVersion(info.ABOUT['version']) from core.mainapplication import MainApplication model = MainApplication() from widgets.mainwindow import MainWindow window = MainWindow(model) window.show() return app.exec_()
def main(argv=None): if not argv: argv = sys.argv app = QApplication(argv) window = MainWindow() window.show() return app.exec_()
def createWindow(dbPath): # OS = detectPlatform() app = QApplication(sys.argv) setPalette(app) win = MainWindow(dbPath) win.show() sys.exit(app.exec_())
def main(argv=None): if not argv: argv = sys.argv app = QApplication(argv) window = MainWindow() window.show() result = app.exec_() app.deleteLater() return result
def main(): app = QtGui.QApplication(sys.argv) try: window=MainWindow() window.show() except serial.SerialException, e: msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Critical, app.tr("Critical error"), app.tr("Could not initialize connection...")) msgBox.setDetailedText(str(e)) msgBox.open()
def main(): app = QtGui.QApplication(sys.argv) try: window = MainWindow() window.show() except serial.SerialException, e: msgBox = QtGui.QMessageBox( QtGui.QMessageBox.Critical, app.tr("Critical error"), app.tr("Could not initialize connection...")) msgBox.setDetailedText(str(e)) msgBox.open()
def main(argv=None): if not argv: argv = sys.argv app = QApplication(argv) lw = LoginWindow() if lw.exec_() == 1: mw = MainWindow(lw.server, lw.user, lw.pw) mw.show() else: app.quit() return return app.exec_()
def main(argv=None): if not argv: argv = sys.argv app = QApplication(argv) translator = QTranslator() translator.load("qt_" + QLocale.system().name(), os.path.join( getResourcesPath(), "translations")) app.installTranslator(translator) myTranslator = QTranslator() myTranslator.load("Tiles_" + QLocale.system().name(), os.path.join( getResourcesPath(), "translations")) app.installTranslator(myTranslator) window = MainWindow() window.show() return app.exec_()
def main(): """ See https://github.com/cztomczak/cefpython/blob/master/api/ApplicationSettings.md for mor settings """ sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error # see for more infos settings = {'auto_zooming': f'{ZOOM_FACTOR}'} cef.Initialize(settings) app = CefApplication(sys.argv) main_window = MainWindow() main_window.show() main_window.activateWindow() main_window.raise_() app.exec_() if not cef.GetAppSetting("external_message_pump"): app.stopTimer() del main_window # Just to be safe, similarly to "del app" del app # Must destroy app object before calling Shutdown cef.Shutdown()
if __name__ == "__main__": QCoreApplication.setApplicationName("Lob") QCoreApplication.setApplicationVersion("0.0.1") QCoreApplication.setOrganizationName("Company") app = QApplication(sys.argv) app.setStyle(QStyleFactory.create("Fusion")) app.setStyleSheet("QPushButton:hover { color: #45bbe6 }") p = app.palette() p.setColor(QPalette.Window, QColor(53, 53, 53)) p.setColor(QPalette.WindowText, Qt.white) p.setColor(QPalette.Base, QColor(64, 66, 68)) p.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) p.setColor(QPalette.ToolTipBase, Qt.white) p.setColor(QPalette.ToolTipText, Qt.black) p.setColor(QPalette.Text, Qt.white) p.setColor(QPalette.Button, QColor(53, 53, 53)) p.setColor(QPalette.ButtonText, Qt.white) p.setColor(QPalette.BrightText, Qt.red) p.setColor(QPalette.Highlight, QColor("#45bbe6")) p.setColor(QPalette.HighlightedText, Qt.black) p.setColor(QPalette.Disabled, QPalette.Text, Qt.darkGray) p.setColor(QPalette.Disabled, QPalette.ButtonText, Qt.darkGray) p.setColor(QPalette.Link, QColor("#bbb")) app.setPalette(p) app.setWindowIcon(QIcon(":/images/logo.svg")) win = MainWindow(app) win.show() sys.exit(app.exec_())
class ConfigWindow(QWidget): def __init__(self): super().__init__() self.__init_window() def __init_game_parameters(self): self.rule_score = rules.ScoreRule.russian self.rule_initial_pos = rules.InitialPosition.cross self.game_width = 10 self.game_height = 10 def __init_window(self): self._initial_position_combobox = \ self.__create_initial_position_combobox() self._score_rule_combobox = self.__create_score_rule_combobox() schemes = SchemePreset() layout = QGridLayout(self) layout.addWidget(QLabel(text='score rule:'), 0, 0) layout.addWidget(self._score_rule_combobox, 0, 1) layout.addWidget(QLabel(text='initial position:'), 1, 0) layout.addWidget(self._initial_position_combobox, 1, 1) layout.addWidget(QLabel(text='Width:'), 2, 0) self.width_slider = ValueSlider(10, 50) layout.addWidget(self.width_slider, 2, 1) layout.addWidget(QLabel(text='Height:'), 3, 0) self.height_slider = ValueSlider(10, 30) layout.addWidget(self.height_slider, 3, 1) self.players_config = PlayersConfig(2, len(schemes), schemes) layout.addWidget(self.players_config, 4, 0, 1, 2) start_button = self.__create_start_button() load_button = self.__create_load_button() layout.addWidget(start_button, 5, 0, 1, 2) layout.addWidget(load_button, 6, 0, 1, 2) layout.setAlignment(Qt.AlignTop) self.setLayout(layout) self.setWindowTitle("points game config") #self.setWindowTitle("нильпотентное отчисление") self.show() def __create_score_rule_combobox(self): score_rule_combobox = QComboBox() for i in rules.ScoreRule: score_rule_combobox.addItem(i.value.name, i) return score_rule_combobox def __create_initial_position_combobox(self): initial_position_combobox = QComboBox() for i in rules.InitialPosition: initial_position_combobox.addItem(i.value.name, i) return initial_position_combobox def __create_start_button(self): start_button = QPushButton(text='start game') start_button.clicked.connect(self.__start_game) return start_button def __create_load_button(self): load_button = QPushButton(text='load game') load_button.clicked.connect(self.__load_game) return load_button def __star_game_window(self, game_state: GameState): self.main_window = MainWindow(game_state) self.main_window.show() self.close() def __load_game(self): if not SAVE_PATH.is_file(): QMessageBox.question(self, 'Error', 'Save file not found or not created', QMessageBox.Yes) return try: with open(SAVE_PATH, 'rb') as file: game_state = pickle.load(file) QMessageBox.question(self, 'info', 'Loaded successfully', QMessageBox.Yes) self.__star_game_window(game_state) except Exception as e: QMessageBox.question(self, 'Error', f'Unable to load: \n{e}', QMessageBox.Yes) def __start_game(self): score_rule = rules.SCORE_RULE_FROM_NAME[ self._score_rule_combobox.currentText()] initial_pos = rules.INITIAL_POSITION_FROM_RULE[ self._initial_position_combobox.currentText()] width = self.width_slider.value height = self.height_slider.value players = self.players_config.get_players() game_state = GameState(size=Point(width, height), score_rule=score_rule, initial_position=initial_pos, players=players) self.__star_game_window(game_state) def paintEvent(self, event): self.update() def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: self.update()