def create_menubar(self): menubar = QMenuBar() file_menu = menubar.addMenu('&File') file_menu.addAction('&New', self.new_script).setShortcut(QKeySequence.New) file_menu.addAction('Save As...', self.save_script_as).setShortcut(QKeySequence.SaveAs) file_menu.addAction('&Open', self.open_script).setShortcut(QKeySequence.Open) file_menu.addAction('&Save', self.save_script).setShortcut(QKeySequence.Save) file_menu.addAction('&Quit', self.close) # Script actions script_menu = menubar.addMenu('&Script') script_menu.addAction('&Evaluate', self.plugin_handler.evaluate_current_script) script_menu.addAction('&Copy Hex', self.script_editor.copy_hex) # Settings and tool toggling tools_menu = menubar.addMenu('&Tools') tools_menu.addAction('&Settings', lambda: SettingsDialog(self).exec_()) tools_menu.addAction('&Plugin Manager', lambda: PluginManager(self).exec_()) tools_menu.addSeparator() self.plugin_handler.create_menu(tools_menu) help_menu = menubar.addMenu('&Help') help_menu.addAction('&About', self.do_about) help_menu.addAction('&Quick Tips', self.do_quick_tips) self.setMenuBar(menubar)
def open_settings(self): try: settings_dialog = SettingsDialog(self.settings, self.netvars_db, self) settings_dialog.exec() except Exception as err: logging.debug(utils.exception_handler(err))
def open_settings(self): try: settings_dialog = SettingsDialog(self.settings, self.db_connection, self) settings_dialog.exec() except Exception as err: utils.exception_handler(err)
def create_menubar(self): menubar = QMenuBar() file_menu = menubar.addMenu('&File') file_menu.addAction('&New', self.new_script).setShortcut(QKeySequence.New) file_menu.addAction('Save As...', self.save_script_as).setShortcut( QKeySequence.SaveAs) file_menu.addAction('&Open', self.open_script).setShortcut(QKeySequence.Open) file_menu.addAction('&Save', self.save_script).setShortcut(QKeySequence.Save) file_menu.addAction('&Quit', self.close) # Script actions script_menu = menubar.addMenu('&Script') script_menu.addAction('&Evaluate', self.dock_handler.evaluate_current_script) # Settings and tool toggling tools_menu = menubar.addMenu('&Tools') tools_menu.addAction('&Settings', lambda: SettingsDialog(self).exec_()) tools_menu.addSeparator() for i in sorted(self.dock_handler.dock_widgets): tools_menu.addAction(i.toggleViewAction()) help_menu = menubar.addMenu('&Help') help_menu.addAction('&About', self.do_about) help_menu.addAction('&Tool Info', lambda: ToolInfo(self).exec_()) help_menu.addAction('&Quick Tips', self.do_quick_tips) self.setMenuBar(menubar)
def __init__(self, iface): # Save reference to the QGIS interface self.iface = iface self.canvas = self.iface.mapCanvas() # Create dialog form self.dlg = AdaplinDialog() # Create settings dialog self.settingsDialog = SettingsDialog()
def __init__(self, iface): logging.info('AdaplinControl:__init__') # Save reference to the QGIS interface self.iface = iface self.canvas = self.iface.mapCanvas() # Create settings dialog self.settingsDialog = SettingsDialog() self.disconnection = None #**#
def openSettings(self): s = QtGui.qApp.settings dlg = SettingsDialog(s) if dlg.exec_() != SettingsDialog.Accepted: return ns = dlg.getData() if ns.connection != s.connection: msg = 'Server connection changed, you should restart to reflect changes' QMessageBox.information(self, 'Major changes', msg) elif ns.camera_type != s.camera_type: msg = 'Camera Type Changed, you should restart to reflect changes' QMessageBox.information(self, 'Major changes', msg) QtGui.qApp.settings = ns QtGui.qApp.saveConfig()
def __init__(self, iface): """Constructor. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface """ # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale self.translator = QTranslator() self.locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'QuickMapServices_{}.qm'.format(self.locale)) if os.path.exists(locale_path): self.translator.load(locale_path) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) self.custom_translator = CustomTranslator() QCoreApplication.installTranslator(self.custom_translator) # Create the dialog (after translation) and keep reference self.settings_dlg = SettingsDialog() self.info_dlg = AboutDialog() # Declare instance attributes self.service_actions = [] self.service_layers = [] # TODO: id and smart remove self._scales_list = None # TileLayer assets self.crs3857 = None self.downloadTimeout = 30 # TODO: settings self.navigationMessagesEnabled = Qt.Checked # TODO: settings self.pluginName = 'QuickMapServices'
def __init__(self, app): super(HashmalMain, self).__init__() self.app = app self.app.setStyleSheet(hashmal_style()) self.changes_saved = True # {Qt.DockWidgetArea: [dock0, dock1, ...], ...} self.dock_orders = defaultdict(list) self.setCorner(QtCore.Qt.BottomRightCorner, QtCore.Qt.RightDockWidgetArea) self.config = Config() self.init_logger() self.config.optionChanged.connect(self.on_option_changed) QtCore.QCoreApplication.setOrganizationName('mazaclub') QtCore.QCoreApplication.setApplicationName('hashmal') self.qt_settings = QtCore.QSettings() active_params = self.config.get_option('chainparams', 'Bitcoin') # True if chainparams needs to be set after plugins load. needs_params_change = False # An exception is thrown if the last-active chainparams preset # only exists due to a plugin that defines it. try: chainparams.set_to_preset(active_params) except KeyError: chainparams.set_to_preset('Bitcoin') needs_params_change = True self.download_controller = DownloadController() self.setDockNestingEnabled(True) # Plugin Handler loads plugins and handles their dock widgets. self.plugin_handler = PluginHandler(self) self.plugin_handler.load_plugins() self.plugin_handler.do_default_layout() # Attempt to load chainparams preset again if necessary. if needs_params_change: try: chainparams.set_to_preset(active_params) except KeyError: self.log_message( 'Core', 'Chainparams preset "%s" does not exist. Setting chainparams to Bitcoin.', logging.ERROR) self.config.set_option('chainparams', 'Bitcoin') # Filename of script being edited. self.filename = '' # The last text that we saved. self.last_saved = '' self.create_script_editor() # Set up script editor font. script_font = self.qt_settings.value( 'editor/font', defaultValue=QtCore.QVariant('default')).toString() if script_font == 'default': font = monospace_font else: font = QFont() font.fromString(script_font) self.script_editor.setFont(font) self.settings_dialog = SettingsDialog(self) self.create_menubar() self.create_toolbar() self.create_actions() self.new_script() self.statusBar().setVisible(True) self.statusBar().messageChanged.connect(self.change_status_bar) self.restoreState( self.qt_settings.value('toolLayout/default/state').toByteArray()) self.restoreGeometry( self.qt_settings.value( 'toolLayout/default/geometry').toByteArray()) self.script_editor.setFocus() if self.qt_settings.value('quickTipsOnStart', defaultValue=QtCore.QVariant(True)).toBool(): QtCore.QTimer.singleShot(500, self.do_quick_tips)
def show_settings(self): config_handler.get_config_parser().getboolean('DEFAULT', 'AlwaysTop') self.init_window_flags(allow_top=False) SettingsDialog().exec() self.init_window_flags(allow_top=True) self.show()
def open_settings(self, _): settings_dialog = SettingsDialog(self.settings, self) settings_dialog.exec()
def action_settings(self): sett_dialog = SettingsDialog() sett_dialog.show() sett_dialog.exec_() self.reinit_tree()
def do_change_settings(self): dlg_settings = SettingsDialog() dlg_settings.show() dlg_settings.projectsDatabaseHasChanged.connect( self.do_load_projects_database) result = dlg_settings.exec_()
logo = QPixmap('./ui/png/tasklogo.png') app.setWindowIcon(QIcon(logo)) style = qdarkstyle.load_stylesheet() app.setStyleSheet(style) try: lbl = _show_splash_screen() istgutgelaufen = True app.loadConfig() app.connectServer() except Exception as ex: istgutgelaufen = False QMessageBox.critical(None, "ma", str(ex)) finally: lbl.hide() if istgutgelaufen: app.mainWindow = MainWindow() app.mainWindow.show() app.exec_() app.closeConnection() else: # wenns nicht gut geht, dialog auftun, dass man connection aendern kann dlg = SettingsDialog(app.settings) dlg.show() app.exec_() if dlg.result() == SettingsDialog.Accepted: app.settings = dlg.getData() app.saveConfig()
def show_settings_dialog(self): settings_dlg = SettingsDialog() settings_dlg.exec_() # apply settings # self.remove_menu_buttons() self.build_menu_tree()
def __init__(self): super().__init__() # 检查python版本是否满足要求 minimum = '3.6.2' current = platform.python_version() current, minimum = (pkg.parse_version(x) for x in (current, minimum)) if current < minimum: msg = msg_box.MsgWarning() msg.setText(f'当前Python版本({current})过低,请升级到{minimum}以上!') msg.exec() sys.exit() self.setWindowTitle(f'{APP_NAME} {APP_VERSION}') self.setWindowIcon(QIcon('img/yologo.png')) gb.init_logger() gb.clean_log() gb.init_config() self.camera = WidgetCamera() # 摄像头 self.info = WidgetInfo() # 信息面板 self.config = WidgetConfig() # Yolo配置界面 self.settings = SettingsDialog() self.signal_config_error.connect(self.slot_msg_dialog) # 模型加载线程 self.load_model_thread = threading.Thread(target=self.load_yolo) self.load_model_thread.start() self.config.btn_settings.clicked.connect(self.settings.exec) self.settings.accepted.connect(self.reload) self.status_icon = QLabel() self.status_text = QLabel() self.update_status('Loading model...', False) hbox = QHBoxLayout() hbox.addWidget(self.status_icon) hbox.addWidget(self.status_text) self.btn_camera = QPushButton('Open/Close Camera') # 开启或关闭摄像头 self.btn_camera.setEnabled(False) self.btn_camera.clicked.connect(self.oc_camera) self.btn_camera.setFixedHeight(60) vbox1 = QVBoxLayout() vbox1.setContentsMargins(0, 0, 0, 0) vbox1.addWidget(self.info) vbox1.addWidget(self.config) vbox1.addStretch() vbox1.addLayout(hbox) vbox1.addWidget(self.btn_camera) right_widget = QWidget() right_widget.setMaximumWidth(400) right_widget.setLayout(vbox1) hbox = QHBoxLayout() hbox.addWidget(self.camera, 3) hbox.addWidget(right_widget, 1) vbox = QVBoxLayout() vbox.addLayout(hbox) self.central_widget = QWidget() self.central_widget.setLayout(vbox) self.setCentralWidget(self.central_widget) # ---------- 自适应不同大小的屏幕 ---------- # screen = QDesktopWidget().screenGeometry(self) available = QDesktopWidget().availableGeometry(self) title_height = self.style().pixelMetric(QStyle.PM_TitleBarHeight) if screen.width() < 1280 or screen.height() < 768: self.setWindowState(Qt.WindowMaximized) # 窗口最大化显示 self.setFixedSize( available.width(), available.height() - title_height) # 固定窗口大小 else: self.setMinimumSize(QSize(1100, 700)) # 最小宽高 self.show() # 显示窗口
def settings(self): """Launch the preferences settings dialog """ self.set_dialog = SettingsDialog(self.prefs)