def show(self): """ Public slot to show the dialog. """ QDialog.show(self) if not self.__hasSearched: self.on_programsSearchButton_clicked()
def accept(self): if self.origCollection: if self.origCollection != self.tmpCollection: self.tmpCollection._id = random_id() self.collection = self.tmpCollection QDialog.accept(self)
def __init__(self, project_finder, project_search_model, projectSearch=None): QDialog.__init__(self) self.setupUi(self) self.project_finder = project_finder self.project_search_model = project_search_model self.projectSearch = projectSearch self.layerCombo.setFilters(QgsMapLayerProxyModel.HasGeometry) self.layerCombo.layerChanged.connect(self.fieldExpressionWidget.setLayer) self.fieldExpressionWidget.setLayer(self.layerCombo.currentLayer()) self.progressBar.hide() self.cancelButton.hide() self.cancelButton.clicked.connect(self.project_finder.stop_record) self.okButton.clicked.connect(self.process) self.project_finder.recordingSearchProgress.connect(self.progressBar.setValue) if projectSearch is not None: self.searchName.setText(projectSearch.searchName) self.layerCombo.setLayer(projectSearch.layer()) self.fieldExpressionWidget.setField(projectSearch.expression) gsIndex = self.geometryStorageCombo.findText(projectSearch.geometryStorage, Qt.MatchFixedString) if gsIndex: self.geometryStorageCombo.setCurrentIndex(gsIndex) self.priorityBox.setValue(projectSearch.priority)
def __init__(self, parent, objets, islabel = False): "Le paramètre 'label' indique si l'objet à éditer est un label" print("OBJETS:") print(objets) print(str(objets[0])) print(repr(objets[0])) print(objets[0].__class__) print(isinstance(objets[0], str)) objets[0].titre_complet("du", False) self.parent = parent self.islabel = islabel self.fenetre_principale = self.parent.window() self.panel = app.fenetre_principale.onglets.onglet_actuel self.canvas = self.panel.canvas self.objets = objets if self.islabel: titre = "du label" else: if len(objets) == 0: self.close() if len(objets) == 1: titre = objets[0].titre_complet("du", False) else: titre = "des objets" # wx.MiniFrame.__init__(self, parent, -1, u"Propriétés " + titre, style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ) QDialog.__init__(self, parent) self.setWindowTitle("Propriétés " + titre) self.setPalette(white_palette) ##self.SetExtraStyle(wx.WS_EX_BLOCK_EVENTS ) main = QVBoxLayout() self.setLayout(main) self.onglets = OngletsProprietes(self) main.addWidget(self.onglets)
def __init__(self, parent, repo, project=None, collection=None): QDialog.__init__(self, parent) self.setupUi(self) self.project = project self.parent = parent self.repo = repo self.repo_uri = os.path.join(repo.base_uri, repo.index_name) self.collection = None self.origCollection = None self.tmpCollection = None if collection: self.origCollection = collection self.tmpCollection = copy.deepcopy(collection) else: self.tmpCollection = PackageCollection(packages=PackageSet(self.repo_uri)) self.connect(self.titleText, SIGNAL("textChanged(const QString &)"), self.titleChanged) self.connect(self.descriptionText, SIGNAL("textChanged()"), self.descriptionChanged) self.connect(self.languagesCombo, SIGNAL("currentIndexChanged(int)"), self.updateTranslations) self.connect(self.packagesButton, SIGNAL("clicked()"), self.slotSelectPackages) self.connect(self.selectIcon, SIGNAL("clicked()"), self.slotSelectIcon) self.connect(self.clearIcon, SIGNAL("clicked()"), self.slotClearIcon) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.fillContent()
def __init__(self, parent): QDialog.__init__(self, parent) self.parent = parent self.setWindowTitle(self.tr('Insert table')) buttonBox = QDialogButtonBox(self) buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.makeTable) buttonBox.rejected.connect(self.close) layout = QGridLayout(self) rowsLabel = QLabel(self.tr('Number of rows') + ':', self) columnsLabel = QLabel(self.tr('Number of columns') + ':', self) self.rowsSpinBox = QSpinBox(self) self.columnsSpinBox = QSpinBox(self) self.rowsSpinBox.setRange(1, 10) self.columnsSpinBox.setRange(1, 10) self.rowsSpinBox.setValue(3) self.columnsSpinBox.setValue(3) layout.addWidget(rowsLabel, 0, 0) layout.addWidget(self.rowsSpinBox, 0, 1, Qt.AlignRight) layout.addWidget(columnsLabel, 1, 0) layout.addWidget(self.columnsSpinBox, 1, 1, Qt.AlignRight) layout.addWidget(buttonBox, 2, 0, 1, 2)
def __init__(self, parent=None): QDialog.__init__(self, parent) self._color = None self._color_global=False self._linewidth=None self._linewidth_global=False self._fontcolor=None self._fontcolor_global=False self._fontsize=None self._fontsize_global=False self.ui = uic.loadUi(os.path.join(os.path.split(__file__)[0], 'box_dialog.ui'), self) self.ui.colorButton.clicked.connect(self.onColor) self.ui.fontColorButton.clicked.connect(self.onFontColor) self.ui.spinBoxWidth.valueChanged.connect(self.setLineWidth) self.ui.spinFontSize.valueChanged.connect(self.setFontSize) self.ui.checkColorGlobal.stateChanged.connect(self.setColorGlobal) self.ui.checkLineWidthGlobal.stateChanged.connect(self.setLineWidthGlobal) self.ui.checkFontColorGlobal.stateChanged.connect(self.setFontColorGlobal) self.ui.checkFontSizeGlobal.stateChanged.connect(self.setFontSizeGlobal) self._modelIndex=None
def __init__(self): QDialog.__init__(self) obj_form= Ui_Form_clientes_buscar() self.obj_form.setupUi(self) self.obj_form.boton_buscar_buscar.clicked.connect(self.buscar_cliente) self.obj_form.boton_limpiar.clicked.connect(self.limpiar) self.obj_form.lne_dni_filtro_buscar.setFocus()
def showMessageSlot(self): dialog = QDialog(core.mainWindow()) uic.loadUi(os.path.join(DATA_FILES_PATH, 'ui/Exception.ui'), dialog) dialog.textBrowser.setText(text) dialog.exec_()
async def show_register_message(self, blockchain_parameters): """ :param sakia.data.entities.BlockchainParameters blockchain_parameters: :return: """ days, hours, minutes, seconds = timestamp_to_dhms(blockchain_parameters.idty_window) expiration_time_str = self.tr("{days} days, {hours}h and {min}min").format(days=days, hours=hours, min=minutes) dialog = QDialog(self) about_dialog = Ui_CongratulationPopup() about_dialog.setupUi(dialog) dialog.setWindowTitle("Registration") about_dialog.label.setText(self.tr(""" <p><b>Congratulations !</b><br> <br> You just published your identity to the network.<br> For your identity to be registered, you will need<br> <b>{certs} certifications</b> from members.<br> Once you got the required certifications, <br> you will be able to validate your registration<br> by <b>publishing your membership request !</b><br> Please notice that your identity document <br> <b>will expire in {expiration_time_str}.</b><br> If you failed to get {certs} certifications before this time, <br> the process will have to be restarted from scratch.</p> """.format(certs=blockchain_parameters.sig_qty, expiration_time_str=expiration_time_str))) await dialog_async_exec(dialog)
def __init__(self, parent, repo, packages=[], components=[]): QDialog.__init__(self, parent) self.setupUi(self) # Package repository self.repo = repo # Selected packages/components self.packages = packages self.components = components self.all_packages = [] # Search widget self.connect(self.searchPackage, SIGNAL("textChanged(const QString &)"), self.slotSearchPackage) # Ok/cancel buttons self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) # Filter combo self.connect(self.comboFilter, SIGNAL("currentIndexChanged(int)"), self.slotComboFilter) # Package/Component changes self.connect(self.treeComponents, SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"), self.slotSelectComponent) self.connect(self.treeComponents, SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self.slotClickComponent) self.connect(self.treePackages, SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"), self.slotSelectPackage) self.connect(self.treePackages, SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self.slotClickPackage) self.subcomponents = False self.component_only = False self.selected_component = None # Go go go! self.initialize()
def __init__(self, parent): QDialog.__init__(self, parent) self.setWindowTitle("Configuration systeme") self.setPalette(white_palette) panel = QWidget(self) panelSizer = QVBoxLayout() textes = informations_configuration().split("\n") for i, texte in enumerate(textes): if texte.startswith("+ "): textes[i] = '<i>' + texte + '</i>' t = QLabel('<br>'.join(textes), panel) panelSizer.addWidget(t) btnOK = QPushButton("OK", panel) btnOK.clicked.connect(self.close) btnCopier = QPushButton("Copier", panel) btnCopier.clicked.connect(self.copier) sizer = QHBoxLayout() sizer.addWidget(btnOK) sizer.addStretch() sizer.addWidget(btnCopier) panelSizer.addLayout(sizer) panel.setLayout(panelSizer) topSizer = QHBoxLayout() topSizer.addWidget(panel) self.setLayout(topSizer)
def __init__(self, parent=None): Ui_JSPlotDialog.__init__(self) QDialog.__init__(self, parent) self.setupUi(self) self.webView.loadFinished.connect(self.draw) self.webView.load(QUrl(timeline_url)) self.tasks = [ { "startDate": 10, "endDate": 20, "taskName": "E Job", "status": "no0" }, { "startDate": 30, "endDate": 40, "taskName": "A Job", "status": "no1" } ] self.taskNames = [ "D Job", "P Job", "E Job", "A Job", "N Job" ] self.statusNames = ["no0", "no1"] self.colors = ["#000000", "#FFDD89", "#957244", "#F26223"]
def __init__(self, parent, data, host_index): QDialog.__init__(self, parent) self.setupUi(self) self.data = data self.host_index = host_index for i, card in enumerate(data): self.tableWidget.insertRow(i) for j in range(self.tableWidget.columnCount()): header = self.tableWidget.horizontalHeaderItem(j).data(Qt.DisplayRole).toString() header = str(header) try: k = card._data[header] if not k: continue #k = k.replace("\n", "<br>") k = QTableWidgetItem(k) self.tableWidget.setItem(i, j, k) except (AttributeError, KeyError, TypeError) as e: print(e) self.tableWidget.resizeRowsToContents() self.tableWidget.resizeColumnsToContents()
def __init__(self, parent, session, script_manager): QDialog.__init__(self, parent) self.setupUi(self) self.red_plugin = parent self.setAttribute(Qt.WA_DeleteOnClose) font = QFont() self.tedit_main.setFont(font) self.session = session self.dialog_session = True self.script_manager = script_manager self.update_info = None self.current_state = self.STATE_INIT self.update_install_serialisation_queue = queue.Queue() self.pbar.hide() self.label_pbar.hide() self.tedit_main.setText(self.MESSAGE_INFO_START) # Connect signals. self.pbutton_n.clicked.connect(self.pbutton_n_clicked) self.pbutton_p.clicked.connect(self.pbutton_p_clicked)
def __init__(self, parent, titre, contenu, fonction_modif): QDialog.__init__(self, parent) self.setWindowTitle(titre) sizer = QVBoxLayout() self.parent = parent self.fonction_modif = fonction_modif self.texte = EditeurPython(self) # self.texte.setMinimumSize(300, 10) self.texte.setText(contenu) ## self.texte.SetInsertionPointEnd() sizer.addWidget(self.texte) boutons = QHBoxLayout() self.btn_modif = QPushButton("Modifier - F5") boutons.addWidget(self.btn_modif) self.btn_esc = QPushButton("Annuler - ESC") boutons.addStretch() boutons.addWidget(self.btn_esc) sizer.addLayout(boutons) self.setLayout(sizer) self.btn_modif.clicked.connect(self.executer) self.btn_esc.clicked.connect(self.close) self.setMinimumSize(400, 500) self.texte.setFocus()
def accept(self): self.languages = [] selected = self.selectedListWidget for index in xrange(selected.count()): item = selected.item(index) self.languages.append(item.code) QDialog.accept(self)
def __init__(self, parent): QDialog.__init__(self, parent, get_modeless_dialog_flags()) self.parent = parent self.setupUi(self) # Synced air pressure, altitude and temperature. Updated with callbacks. self.air_pressure = 0 self.altitude = 0 self.temperature = 0 self.btn_cal_remove.clicked.connect(self.btn_cal_remove_clicked) self.btn_cal_calibrate.clicked.connect(self.btn_cal_calibrate_clicked) self.cbe_air_pressure = CallbackEmulator(self.parent.barometer.get_air_pressure, None, self.cb_air_pressure, self.parent.increase_error_count) self.cbe_altitude = CallbackEmulator(self.parent.barometer.get_altitude, None, self.cb_altitude, self.parent.increase_error_count) self.cbe_temperature = CallbackEmulator(self.parent.barometer.get_temperature, None, self.cb_temperature, self.parent.increase_error_count)
def __init__(self): QDialog.__init__(self) self.setWindowTitle('pyqt5界面实时更新例子') self.resize(400, 100) self.input = QLineEdit(self) self.input.resize(400, 100) self.initUI()
def configurePreferences(self): print("controller.configurePreferences") # preferenceDialog = Preferences(self) # preferenceDialog.show() preferencesDialog = QDialog(self) preferencesUi = Ui_Dialog() preferencesUi.setupUi(preferencesDialog) # read preferences and set values in dialog try: with open('preferences.pickle', 'rb') as f: preferences = pickle.load(f) preferencesUi.dbIp.setText(preferences['host']) preferencesUi.dbUsername.setText(preferences['username']) preferencesUi.dbPassword.setText(preferences['password']) except: print('Preferences not found') preferencesUi.dbIp.setText("") preferencesUi.dbUsername.setText("") preferencesUi.dbPassword.setText("") # if dialog is displayed if preferencesDialog.exec_(): #extract values from dialog preferences = {} preferences['host'] = preferencesUi.dbIp.text() preferences['username'] = preferencesUi.dbUsername.text() preferences['password'] = preferencesUi.dbPassword.text() preferences['database'] = 'Roland Richter' with open('preferences.pickle', 'wb') as f: preferences = pickle.dump(preferences, f)
def __init__(self, parent, url): QDialog.__init__(self, parent) self.resize(800, 600) l = QVBoxLayout() self.te = QTextBrowser(self) self.te.sourceChanged.connect(self.onSourceChanged) self.te.setOpenExternalLinks(True) if not url.startswith('http'): pwd = os.path.dirname(__file__) locale = QSettings().value("locale/userLocale")[0:2] file = "{}/doc/{}/{}".format(pwd, locale, url) if not os.path.isfile(file): file = "{}/doc/en/{}".format(pwd, url) self.te.setSource(QUrl.fromLocalFile(file)) else: self.te.setSource(QUrl(url)) btn = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self) btn.clicked.connect(self.close) l.addWidget(self.te) l.addWidget(btn) self.setLayout(l)
def __init__(self, parent): QDialog.__init__(self, parent, get_modeless_dialog_flags()) self.setupUi(self) self.parent = parent self.master = self.parent.master self.client_group = [ (self.wifi_client_status_status, self.wifi_client_status_status_label), (self.wifi_client_status_signal_strength, self.wifi_client_status_signal_strength_label), (self.wifi_client_status_ip, self.wifi_client_status_ip_label), (self.wifi_client_status_subnet_mask, self.wifi_client_status_subnet_mask_label), (self.wifi_client_status_gateway, self.wifi_client_status_gateway_label), (self.wifi_client_status_mac_address, self.wifi_client_status_mac_address_label), (self.wifi_client_status_rx, self.wifi_client_status_rx_label), (self.wifi_client_status_tx, self.wifi_client_status_tx_label), ] self.ap_group = [ (self.wifi_ap_status_connected_count, self.wifi_ap_status_connected_count_label), (self.wifi_ap_status_ip, self.wifi_ap_status_ip_label), (self.wifi_ap_status_subnet_mask, self.wifi_ap_status_subnet_mask_label), (self.wifi_ap_status_gateway, self.wifi_ap_status_gateway_label), (self.wifi_ap_status_mac_address, self.wifi_ap_status_mac_address_label), (self.wifi_ap_status_rx, self.wifi_ap_status_rx_label), (self.wifi_ap_status_tx, self.wifi_ap_status_tx_label), ] self.wifi_status_button_close.clicked.connect(self.close) self.update_status()
def __init__(self, data=DataStore): QDialog.__init__(self) self.data = data self.inbound_sequence_list = [] self.outbound_sequence_list = [] self.inbound_buttons = [] self.outbound_buttons = [] self.inboundlayout = QHBoxLayout() self.outboundlayout = QHBoxLayout() self.layout = QVBoxLayout() self.layout.addLayout(self.inboundlayout) self.layout.addLayout(self.outboundlayout) self.done_button = QPushButton('Done') self.done_button.clicked.connect(self.sequence_done) self.layout.addWidget(self.done_button) self.setWindowTitle('Set Sequence') self.setGeometry(300, 400, 500, 500) self.setWindowModality(Qt.ApplicationModal) self.setLayout(self.layout) self.set_truck_and_doors() self.set_buttons() self.sequence = Sequence()
def error(self, summary, msg, extended_msg=None): msg="<big><b>%s</b></big><br />%s" % (summary, msg) dialogue = QDialog(self.window_main) loadUi("dialog_error.ui", dialogue) self.translate_widget_children(dialogue) dialogue.label_error.setText(msg) if extended_msg != None: dialogue.textview_error.setText(extended_msg) dialogue.textview_error.show() else: dialogue.textview_error.hide() if os.path.exists("/usr/share/icons/oxygen/48x48/status/dialog-error.png"): messageIcon = QPixmap("/usr/share/icons/oxygen/48x48/status/dialog-error.png") elif os.path.exists("/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-error.png"): messageIcon = QPixmap("/usr/lib/kde4/share/icons/oxygen/48x48/status/dialog-error.png") else: messageIcon = QPixmap("/usr/share/icons/crystalsvg/32x32/actions/messagebox_critical.png") dialogue.image.setPixmap(messageIcon) # Make sure we have a suitable size depending on whether or not the view is shown dialogue.adjustSize() dialogue.exec_() return False
def __init__(self, parent=None, update=True): QDialog.__init__(self, parent=parent) layout = QVBoxLayout() self.tree = QTreeWidget() layout.addWidget(self.tree) self.setLayout(layout) self._mgr = CacheMemoryManager() self._tracked_caches = {} # tree setup code self.tree.setHeaderLabels( ["cache", "memory", "roi", "dtype", "type", "info", "id"]) self._idIndex = self.tree.columnCount() - 1 self.tree.setColumnHidden(self._idIndex, True) self.tree.setSortingEnabled(True) self.tree.clear() self._root = TreeNode() # refresh every x seconds (see showEvent()) self.timer = QTimer(self) if update: self.timer.timeout.connect(self._updateReport)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.config = Configurator() self.setupUi(self) self.pushButtonLoading.setDisabled(True) self.comboBoxDatabase.activated.connect(self.showFbPathButton) self.pushButtonShemaList.clicked.connect(self.showTableShemaList) self.toolButtonPath.clicked.connect(self.browse) self.pushButtonLoading.clicked.connect(self.downloading) self.lineEditVersionDownload.textChanged.connect(self.activatePushButtonLoading) self.lineEditPath.textChanged.connect(self.activatePushButtonLoading) self.lineEditReport.textChanged.connect(self.activatePushButtonLoading) self.pushButtonReport.clicked.connect(self.viewReports) self.pushButtonVersion.clicked.connect(self.viewVersion) self.table = TreeShemaForm(self) self.table.setTextToAzkFormLabel.connect(self.setTextToAzkFormLabel) self.reportDialog = DialogReports(self) self.reportDialog.setTextToLineEditReport.connect(self.setTextlineEditReport) self.DialogLog = DialogLog(self) self.versiondict = {} self.reportdict = {} self.pathReport1 = self.config.getoption('azkfin', 'report1') self.pathReport2 = self.config.getoption('azkfin', 'report2') self.pathVersion1 = self.config.getoption('azkfin', 'path1') self.pathVersion2 = self.config.getoption('azkfin', 'path2') self.extr = self.config.getoption('dialog', '7z')
def _handleException(self, exctype, excvalue, exctb): """Crash handler.""" if (issubclass(exctype, KeyboardInterrupt) or issubclass(exctype, SystemExit)): return # we handle the exception here, hand it to apport and run the # apport gui manually after it because we kill u-m during the upgrade # to prevent it from popping up for reboot notifications or FF restart # notifications or somesuch lines = traceback.format_exception(exctype, excvalue, exctb) logging.error("not handled exception in KDE frontend:\n%s" % "\n".join(lines)) # we can't be sure that apport will run in the middle of a upgrade # so we still show a error message here apport_crash(exctype, excvalue, exctb) if not run_apport(): tbtext = ''.join(traceback.format_exception(exctype, excvalue, exctb)) dialog = QDialog(self.window_main) loadUi("dialog_error.ui", dialog) self.translate_widget_children(self.dialog) dialog.crash_detail.setText(tbtext) # Make sure we have a suitable size depending on whether or not the view is shown dialog.adjustSize() dialog.exec_() sys.exit(1)
def __init__(self, parent=None, numStages=1): QDialog.__init__(self, parent) self.threadRouter = ThreadRouter(self) self.currentStep = 0 self.progress = None l = QVBoxLayout() self.setLayout(l) self.overallProgress = QProgressBar() self.overallProgress.setRange(0, numStages) self.overallProgress.setFormat("step %v of "+str(numStages)) self.currentStepProgress = QProgressBar() self.currentStepProgress.setRange(0, 100) self.currentStepProgress.setFormat("%p %") self.overallLabel = QLabel("Overall progress") self.currentStepLabel = QLabel("Current step") l.addWidget(self.overallLabel) l.addWidget(self.overallProgress) l.addWidget(self.currentStepLabel) l.addWidget(self.currentStepProgress) l.maximumSize() self.update()
def __init__(self): QMainWindow.__init__(self) # Create the File menu self.menuFile = self.menuBar().addMenu("&File") self.actionSaveAs = QAction("&Save As", self) self.actionSaveAs.triggered.connect(self.saveas) self.actionQuit = QAction("&Quit", self) self.actionQuit.triggered.connect(self.close) self.menuFile.addActions([self.actionSaveAs, self.actionQuit]) # Create the Help menu self.menuHelp = self.menuBar().addMenu("&Help") self.actionAbout = QAction("&About",self) self.actionAbout.triggered.connect(self.about) self.menuHelp.addActions([self.actionAbout]) # Setup main widget widget = QDialog() edit1 = QLineEdit("widget 1") edit2 = QLineEdit("widget 2") layout = QVBoxLayout() layout.addWidget(edit1) layout.addWidget(edit2) widget.setLayout(layout) self.setCentralWidget(widget)
def displayStore2Dialog(self): # if 'ok' then update current invoice # and webview print("controller.displayStore2Dialog") store2Dialog = QDialog(self) store2Ui = Ui_StoreDialog() store2Ui.setupUi(store2Dialog) cInvoice = self.model.getCurrentInvoice() # set values in dialog store2Ui.name.setText(cInvoice.store2.name) store2Ui.manager.setText(cInvoice.store2.manager) store2Ui.address1.setText(cInvoice.store2.address1) store2Ui.address2.setText(cInvoice.store2.address2) store2Ui.telNo.setText(cInvoice.store2.telNo) # if dialog is displayed if store2Dialog.exec_(): #extract values from dialog setattr(cInvoice.store2,"name",store2Ui.name.text()) setattr(cInvoice.store2,"manager",store2Ui.manager.text()) setattr(cInvoice.store2,"address1",store2Ui.address1.text()) setattr(cInvoice.store2,"address2",store2Ui.address2.text()) setattr(cInvoice.store2,"telNo",store2Ui.telNo.text()) self.ui.webView.setHtml(self.model.getPreviewCurrentInvoice(), self.baseUrl) self.ui.webView.page().mainFrame().addToJavaScriptWindowObject("controller", self)
def __init__(self, parent, host, hasCanvas, hasCanvasGL): QDialog.__init__(self, parent) self.host = host self.ui = ui_carla_settings.Ui_CarlaSettingsW() self.ui.setupUi(self) if False: # kdevelop likes this :) host = CarlaHostNull() self.host = host # ---------------------------------------------------------------------------------------------------- # Set-up GUI self.ui.lw_page.setFixedWidth( 48 + 6 + 6 + QFontMetrics(self.ui.lw_page.font()).width("88888888")) for i in range(host.get_engine_driver_count()): self.ui.cb_engine_audio_driver.addItem( host.get_engine_driver_name(i)) for i in range(Theme.THEME_MAX): self.ui.cb_canvas_theme.addItem(getThemeName(i)) if MACOS or (WINDOWS and not config_UseQt5): self.ui.group_main_theme.setEnabled(False) self.ui.group_main_theme.setVisible(False) if MACOS or WINDOWS: self.ui.ch_main_manage_uis.setEnabled(False) self.ui.ch_main_manage_uis.setVisible(False) if WINDOWS or host.isControl: self.ui.ch_main_show_logs.setEnabled(False) self.ui.ch_main_show_logs.setVisible(False) if host.isControl: self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS) self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE) self.ui.lw_page.hideRow(self.TAB_INDEX_PATHS) elif not hasCanvas: self.ui.lw_page.hideRow(self.TAB_INDEX_CANVAS) elif not hasCanvasGL: self.ui.cb_canvas_use_opengl.setEnabled(False) self.ui.cb_canvas_render_hq_aa.setEnabled(False) if host.isPlugin: self.ui.cb_engine_audio_driver.setEnabled(False) if host.audioDriverForced is not None: self.ui.cb_engine_audio_driver.setEnabled(False) self.ui.tb_engine_driver_config.setEnabled(False) if host.processModeForced: self.ui.cb_engine_process_mode_jack.setEnabled(False) self.ui.cb_engine_process_mode_other.setEnabled(False) if self.host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK: self.ui.ch_engine_force_stereo.setEnabled(False) # FIXME, pipes on win32 not working if WINDOWS: self.ui.ch_engine_prefer_ui_bridges.setChecked(False) self.ui.ch_engine_prefer_ui_bridges.setEnabled(False) self.ui.ch_engine_prefer_ui_bridges.setVisible(False) # FIXME, not implemented yet self.ui.ch_engine_uis_always_on_top.hide() # ---------------------------------------------------------------------------------------------------- # Load settings self.loadSettings() # ---------------------------------------------------------------------------------------------------- # Set-up connections self.accepted.connect(self.slot_saveSettings) self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect( self.slot_resetSettings) self.ui.b_main_proj_folder_open.clicked.connect( self.slot_getAndSetProjectPath) self.ui.cb_engine_audio_driver.currentIndexChanged.connect( self.slot_engineAudioDriverChanged) self.ui.tb_engine_driver_config.clicked.connect( self.slot_showAudioDriverSettings) self.ui.b_paths_add.clicked.connect(self.slot_addPluginPath) self.ui.b_paths_remove.clicked.connect(self.slot_removePluginPath) self.ui.b_paths_change.clicked.connect(self.slot_changePluginPath) self.ui.cb_paths.currentIndexChanged.connect( self.slot_pluginPathTabChanged) self.ui.lw_ladspa.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_dssi.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_lv2.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_vst.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_vst3.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_gig.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_sf2.currentRowChanged.connect( self.slot_pluginPathRowChanged) self.ui.lw_sfz.currentRowChanged.connect( self.slot_pluginPathRowChanged) # ---------------------------------------------------------------------------------------------------- # Post-connect setup self.ui.lw_ladspa.setCurrentRow(0) self.ui.lw_dssi.setCurrentRow(0) self.ui.lw_lv2.setCurrentRow(0) self.ui.lw_vst.setCurrentRow(0) self.ui.lw_vst3.setCurrentRow(0) self.ui.lw_gig.setCurrentRow(0) self.ui.lw_sf2.setCurrentRow(0) self.ui.lw_sfz.setCurrentRow(0) self.ui.lw_page.setCurrentCell(0, 0)
def fio_(self): diag = QDialog(self) diag.setWindowTitle("Capture") # main layout diag.lay = QtWidgets.QVBoxLayout() # widgets diag.capture_button = QtWidgets.QPushButton("Capture") diag.capture_button.clicked.connect(self.capture_img) diag.label = QtWidgets.QLabel("") # setting the device diag.device = QCamera.availableDevices()[0] diag.m_camera = QCamera(diag.device) #test #diag.label.setText(str(diag.m_camera.availableDevices())) diag.view_finder = QtMultimediaWidgets.QCameraViewfinder() diag.view_finder.setMinimumSize(250, 250) diag.m_camera.setViewfinder(diag.view_finder) diag.m_camera.setCaptureMode(QCamera.CaptureStillImage) try: diag.m_camera.start() except: pass diag.lay.addWidget(diag.label) diag.lay.addWidget(diag.view_finder) diag.lay.addWidget(diag.capture_button) diag.lay.addWidget(diag.label) diag.setLayout(diag.lay) diag.cp = QCameraImageCapture(diag.m_camera) diag.cp.imageCaptured.connect(self.capture_img_handler) diag.cp.imageSaved.connect(self.save_img) self.capture_diag = diag diag.show() diag.exec_()
def __init__(self, *, parent: 'ElectrumWindow', desc, prompt_if_unsaved, finalized: bool, external_keypairs=None): '''Transactions in the wallet will show their description. Pass desc to give a description for txs not yet in the wallet. ''' # We want to be a top-level window QDialog.__init__(self, parent=None) self.tx = None # type: Optional[Transaction] self.external_keypairs = external_keypairs self.finalized = finalized self.main_window = parent self.config = parent.config self.wallet = parent.wallet self.prompt_if_unsaved = prompt_if_unsaved self.saved = False self.desc = desc self.setMinimumWidth(950) self.set_title() self.psbt_only_widgets = [] # type: List[QWidget] vbox = QVBoxLayout() self.setLayout(vbox) vbox.addWidget(QLabel(_("Transaction ID:"))) self.tx_hash_e = ButtonsLineEdit() qr_show = lambda: parent.show_qrcode( str(self.tx_hash_e.text()), 'Transaction ID', parent=self) qr_icon = "qrcode_white.png" if ColorScheme.dark_scheme else "qrcode.png" self.tx_hash_e.addButton(qr_icon, qr_show, _("Show as QR code")) self.tx_hash_e.setReadOnly(True) vbox.addWidget(self.tx_hash_e) self.add_tx_stats(vbox) vbox.addSpacing(10) self.inputs_header = QLabel() vbox.addWidget(self.inputs_header) self.inputs_textedit = QTextEditWithDefaultSize() vbox.addWidget(self.inputs_textedit) self.outputs_header = QLabel() vbox.addWidget(self.outputs_header) self.outputs_textedit = QTextEditWithDefaultSize() vbox.addWidget(self.outputs_textedit) self.sign_button = b = QPushButton(_("Sign")) b.clicked.connect(self.sign) self.broadcast_button = b = QPushButton(_("Broadcast")) b.clicked.connect(self.do_broadcast) self.save_button = b = QPushButton(_("Save")) b.clicked.connect(self.save) self.cancel_button = b = QPushButton(_("Close")) b.clicked.connect(self.close) b.setDefault(True) self.export_actions_menu = export_actions_menu = QMenu() self.add_export_actions_to_menu(export_actions_menu) export_actions_menu.addSeparator() export_submenu = export_actions_menu.addMenu( _("For CoinJoin; strip privates")) self.add_export_actions_to_menu(export_submenu, gettx=self._gettx_for_coinjoin) self.psbt_only_widgets.append(export_submenu) export_submenu = export_actions_menu.addMenu( _("For hardware device; include xpubs")) self.add_export_actions_to_menu(export_submenu, gettx=self._gettx_for_hardware_device) self.psbt_only_widgets.append(export_submenu) self.export_actions_button = QToolButton() self.export_actions_button.setText(_("Export")) self.export_actions_button.setMenu(export_actions_menu) self.export_actions_button.setPopupMode(QToolButton.InstantPopup) self.finalize_button = QPushButton(_('Finalize')) self.finalize_button.clicked.connect(self.on_finalize) partial_tx_actions_menu = QMenu() ptx_merge_sigs_action = QAction(_("Merge signatures from"), self) ptx_merge_sigs_action.triggered.connect(self.merge_sigs) partial_tx_actions_menu.addAction(ptx_merge_sigs_action) self._ptx_join_txs_action = QAction(_("Join inputs/outputs"), self) self._ptx_join_txs_action.triggered.connect(self.join_tx_with_another) partial_tx_actions_menu.addAction(self._ptx_join_txs_action) self.partial_tx_actions_button = QToolButton() self.partial_tx_actions_button.setText(_("Combine")) self.partial_tx_actions_button.setMenu(partial_tx_actions_menu) self.partial_tx_actions_button.setPopupMode(QToolButton.InstantPopup) self.psbt_only_widgets.append(self.partial_tx_actions_button) # Action buttons self.buttons = [ self.partial_tx_actions_button, self.sign_button, self.broadcast_button, self.cancel_button ] # Transaction sharing buttons self.sharing_buttons = [ self.finalize_button, self.export_actions_button, self.save_button ] run_hook('transaction_dialog', self) if not self.finalized: self.create_fee_controls() vbox.addWidget(self.feecontrol_fields) self.hbox = hbox = QHBoxLayout() hbox.addLayout(Buttons(*self.sharing_buttons)) hbox.addStretch(1) hbox.addLayout(Buttons(*self.buttons)) vbox.addLayout(hbox) self.set_buttons_visibility() dialogs.append(self)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.dialog = QDialog() self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.ScanButton = QtWidgets.QPushButton(self.centralwidget) self.ScanButton.setGeometry(QtCore.QRect(310, 470, 150, 46)) self.ScanButton.setObjectName("ScanButton") self.building_ID = QtWidgets.QLabel(self.centralwidget) self.building_ID.setGeometry(QtCore.QRect(110, 70, 241, 24)) self.building_ID.setObjectName("building_ID") self.RP_ID = QtWidgets.QLabel(self.centralwidget) self.RP_ID.setGeometry(QtCore.QRect(120, 240, 241, 24)) self.RP_ID.setObjectName("RP_ID") # self.building_comboBox = QtWidgets.QComboBox(self.centralwidget) self.building_comboBox.setGeometry(QtCore.QRect(120, 100, 261, 41)) self.building_comboBox.setObjectName("building_comboBox") self.RP_comboBox = QtWidgets.QComboBox(self.centralwidget) self.RP_comboBox.setGeometry(QtCore.QRect(120, 280, 261, 41)) self.RP_comboBox.setObjectName("RP_comboBox") # self.line = QtWidgets.QFrame(self.centralwidget) self.line.setGeometry(QtCore.QRect(120, 190, 118, 3)) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.building_newbutton = QtWidgets.QPushButton(self.centralwidget) self.building_newbutton.setGeometry(QtCore.QRect(440, 90, 150, 46)) self.building_newbutton.setObjectName("building_newbutton") self.RP_newbutton = QtWidgets.QPushButton(self.centralwidget) self.RP_newbutton.setGeometry(QtCore.QRect(450, 280, 150, 46)) self.RP_newbutton.setObjectName("RP_newbutton") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 38)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.building_newbutton.clicked.connect(MainWindow.new_building) self.ScanButton.clicked.connect(MainWindow.scan) self.RP_newbutton.clicked.connect(MainWindow.new_rp) QtCore.QMetaObject.connectSlotsByName(MainWindow) print(self.data_path) # self.building_comboBox.clear() for building in listdir(self.data_path): if isdir(join(self.data_path, building)): self.building_comboBox.addItem(building) # load region information of building when started for RP in listdir( join(self.data_path, self.building_comboBox.currentText())): self.RP_comboBox.addItem(splitext(RP)[0]) self.building_comboBox.currentTextChanged.connect( self.onBuildingChanged)
def run_from_line(P, W, ACTION, STATUS, linuxcnc): inData, outData, newFile, params = [], [], [], [] g2, g4, g6, g9, g9arc, d3, d2, a3, material, x, y, code, rflSpindle = '', '', '', '', '', '', '', '', '', '', '', '', '' oSub = False count = 0 tmpMat = False head = _translate('HandlerClass', 'GCODE ERROR') with open(P.lastLoadedProgram, 'r') as inFile: for line in inFile: if count < P.startLine: inData.append(line.lower()) else: if count == P.startLine: if 'g21' in line: newFile.append('g21') elif 'g20' in line: newFile.append('g20') outData.append(line.lower()) count += 1 cutComp = False for line in inData: if line.startswith('('): if line.startswith('(o='): material = line.strip() continue if line.startswith('#'): params.append(line.strip()) continue if line.startswith('m190'): mat = line.split('p')[1] try: if '(' in mat: num = int(mat.split('(')[0]) else: num = int(mat) except: head = _translate('HandlerClass', 'G-CODE ERROR') msg0 = _translate('HandlerClass', 'is an invalid material number') msg1 = _translate('HandlerClass', 'Material #0 will be selected') STATUS.emit('error', linuxcnc.OPERATOR_ERROR, '{}:\n"{}" {}\n{}\n'.format(head, mat, msg0, msg1)) num = 0 if num >= 1000000: tmpMat = True else: material = line.strip() continue if line.replace(' ', '').startswith('m66p3') and tmpMat: tmpMat = False continue for t1 in [ 'g20', 'g21', 'g40', 'g41.1', 'g42.1', 'g61', 'g61.1', 'g64', 'g90', 'g90.1', 'g91', 'g91.1' ]: if t1 in line: if t1[1] == '2': g2 = t1 elif t1[1] == '4': g4 = t1 if t1 != 'g40': cutComp = True else: cutComp = False elif t1[1] == '6': g6 = t1 if t1 == 'g64': tmp = line.split('64')[1] if tmp[0] == 'p': p = '' tmp = tmp[1:] while 1: if tmp[0] in '.0123456789q': p += tmp[0] tmp = tmp[1:] else: break g6 = 'g64p{}'.format(p) elif t1 == 'g90' and not 'g90.1' in line: g9 = 'g90' elif t1 == 'g91' and not 'g91.1' in line: g9 = 'g91' elif t1 == 'g90.1' in line: g9arc = 'g90.1' elif t1 == 'g91.1' in line: g9arc = 'g91.1' if 'g0' in line: code = 'g0' if 'g1' in line: tmp = line.split('g1')[1] if tmp[0] not in '0123456789': code = 'g1' if 'g2' in line: tmp = line.split('g2')[1] if tmp[0] not in '0123456789': code = 'g2' if 'g3' in line: tmp = line.split('g3')[1] if tmp[0] not in '0123456789': code = 'g3' if 'x' in line: x = get_rfl_pos(line.strip(), x, 'x') if 'y' in line: y = get_rfl_pos(line.strip(), y, 'y') if 'm3' in line: rflSpindle = 'm3' tmp = line.split('m3')[1] while 1: if tmp[0] in '0123456789s$': rflSpindle += tmp[0] tmp = tmp[1:] else: break if 'm5' in line: rflSpindle = '' if 'm62p3' in line.replace(' ', ''): d3 = 'm62p3 (Disable Torch)' elif 'm63p3' in line.replace(' ', ''): d3 = 'm63p3 (Enable Torch)' elif 'm64p3' in line.replace(' ', ''): d3 = 'm64p3 (Disable Torch)' elif 'm65p3' in line.replace(' ', ''): print("M65 P2 found in", line.strip()) d3 = 'm65p3 (Enable Torch)' if 'm62p2' in line.replace(' ', ''): print("M62 P2 found in", line.strip()) d2 = 'm62p2 (Disable THC)' elif 'm63p2' in line.replace(' ', ''): d2 = 'm63p2 (Enable THC)' elif 'm64p2' in line.replace(' ', ''): d2 = 'm64p2 (Disable THC)' elif 'm65p2' in line.replace(' ', ''): d2 = 'm65p2 (Enable THC)' if 'm67e3q' in line.replace(' ', ''): a3 = 'm67e3q' tmp = line.replace(' ', '').split('m67e3q')[1] while 1: if tmp[0] in '-.0123456789': a3 += tmp[0] tmp = tmp[1:] else: break pc = int(a3.split('m67e3q')[1]) pc = pc if pc > 0 else 100 a3 += ' (Velocity {}%)'.format(pc) if 'm68e3q' in line.replace(' ', ''): print("M68 E3 Q found in", line.strip()) a3 = 'm68e3q' tmp = line.replace(' ', '').split('m68e3q')[1] bb = 1 while 1: if tmp[0] in '-.0123456789': a3 += tmp[0] tmp = tmp[1:] else: break pc = int(a3.split('m68e3q')[1]) pc = pc if pc > 0 else 100 a3 += ' (Velocity {}%)'.format(pc) if line.startswith('o'): if 'end' in line: oSub = False else: oSub = True if cutComp or oSub: if cutComp: msg0 = _translate('HandlerClass', 'Cannot run from line while') msg1 = _translate('HandlerClass', 'cutter compensation is active') elif oSub: msg0 = _translate('HandlerClass', 'Cannot do run from line') msg1 = _translate('HandlerClass', 'inside a subroutine') STATUS.emit('error', linuxcnc.OPERATOR_ERROR, '{}:\n{}\n{}\n'.format(head, msg0, msg1)) P.rflActive = False P.set_run_button_state() P.startLine = 0 return # show the dialog rFl = QDialog(W) rFl.setWindowTitle(_translate('HandlerClass', 'RUN FROM LINE')) lbl1 = QLabel(_translate('HandlerClass', 'USE LEADIN:')) lbl2 = QLabel(_translate('HandlerClass', 'LEADIN LENGTH:')) lbl3 = QLabel(_translate('HandlerClass', 'LEADIN ANGLE:')) lbl4 = QLabel('') leadinDo = QCheckBox() leadinLength = QDoubleSpinBox() leadinAngle = QDoubleSpinBox() buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel buttonBox = QDialogButtonBox(buttons) buttonBox.accepted.connect(rFl.accept) buttonBox.rejected.connect(rFl.reject) buttonBox.button(QDialogButtonBox.Ok).setText( _translate('HandlerClass', 'LOAD')) buttonBox.button(QDialogButtonBox.Ok).setIcon(QIcon()) buttonBox.button(QDialogButtonBox.Cancel).setText( _translate('HandlerClass', 'CANCEL')) buttonBox.button(QDialogButtonBox.Cancel).setIcon(QIcon()) layout = QGridLayout() layout.addWidget(lbl1, 0, 0) layout.addWidget(lbl2, 1, 0) layout.addWidget(lbl3, 2, 0) layout.addWidget(lbl4, 3, 0) layout.addWidget(leadinDo, 0, 1) layout.addWidget(leadinLength, 1, 1) layout.addWidget(leadinAngle, 2, 1) layout.addWidget(buttonBox, 4, 0, 1, 2) rFl.setLayout(layout) lbl1.setAlignment(Qt.AlignRight | Qt.AlignBottom) lbl2.setAlignment(Qt.AlignRight | Qt.AlignBottom) lbl3.setAlignment(Qt.AlignRight | Qt.AlignBottom) if P.units == 'inch': leadinLength.setDecimals(2) leadinLength.setSingleStep(0.05) leadinLength.setSuffix(' inch') leadinLength.setMinimum(0.05) else: leadinLength.setDecimals(0) leadinLength.setSingleStep(1) leadinLength.setSuffix(' mm') leadinLength.setMinimum(1) leadinAngle.setDecimals(0) leadinAngle.setSingleStep(1) leadinAngle.setSuffix(' deg') leadinAngle.setRange(-359, 359) leadinAngle.setWrapping(True) result = rFl.exec_() # cancel from dialog if not result: P.rflActive = False P.set_run_button_state() P.startLine = 0 W.gcode_display.setCursorPosition(0, 0) return # run from dialog for param in params: if param: newFile.append(param) scale = 1 zMax = '' if P.unitsPerMm == 1: if g2 == 'g20': scale = 0.03937 zMax = 'g53 g0z[[#<_ini[axis_z]max_limit> - 5] * 0.03937]' else: zMax = 'g53 g0z[#<_ini[axis_z]max_limit> - 5]' elif P.unitsPerMm == 0.03937: if g2 == 'g21': scale = 25.4 zMax = 'g53 g0z[[#<_ini[axis_z]max_limit> * 25.4] - 5]' else: zMax = 'g53 g0z[#<_ini[axis_z]max_limit> - 0.02]' if g2: newFile.append(g2) if g4: newFile.append(g4) if g6: newFile.append(g6) if g9: newFile.append(g9) if g9arc: newFile.append(g9arc) newFile.append('M52 P1') if d3: newFile.append(d3) if d2: newFile.append(d2) if a3: newFile.append(a3) if zMax: newFile.append(zMax) if material: newFile.append(material) if not '(o=' in material: newFile.append('m66p3l3q1') # don't scale feedrate, parameters should be set correctly in material file newFile.append('f#<_hal[plasmac.cut-feed-rate]>') xL = x yL = y try: if leadinDo.isChecked(): if x[-1] == ']': xL = '{}[[{}]+{:0.6f}]'.format( x[:1], x[1:], (leadinLength.value() * scale) * math.cos(math.radians(leadinAngle.value()))) yL = '{}[[{}]+{:0.6f}]'.format( y[:1], y[1:], (leadinLength.value() * scale) * math.sin(math.radians(leadinAngle.value()))) else: xL = float(x) + ((leadinLength.value() * scale) * math.cos(math.radians(leadinAngle.value()))) yL = float(y) + ((leadinLength.value() * scale) * math.sin(math.radians(leadinAngle.value()))) except: msg0 = _translate('HandlerClass', 'Unable to calculate a leadin for this cut') msg1 = _translate( 'HandlerClass', 'Program will run from selected line with no leadin applied') STATUS.emit('error', linuxcnc.OPERATOR_ERROR, '{}:\n{}\n{}\n'.format(head, msg0, msg1)) if xL != x and yL != y: newFile.append('G0 X{} Y{}'.format(xL, yL)) rflLead = [x, y] else: if x and y: newFile.append('G0 X{} Y{}'.format(x, y)) elif x: newFile.append('G0 X{}'.format(x)) elif y: newFile.append('G0 Y{}'.format(y)) rflLead = None if rflSpindle: newFile.append(rflSpindle) if rflLead: newFile.append('G1 X{} Y{}'.format(rflLead[0], rflLead[1])) for line in outData: if outData.index(line) == 0 and (line.startswith('x') or line.startswith('y')): line = '{}{}'.format(code, line) elif line.startswith('m190'): mat = line.split('p')[1] if '(' in mat: num = int(mat.split('(')[0]) else: num = int(mat) if num >= 1000000: tmpMat = True continue elif line.replace(' ', '').startswith('m66p3') and tmpMat: tmpMat = False continue newFile.append(line.strip()) rflFile = '{}rfl.ngc'.format(P.tmpPath) with open(rflFile, 'w') as outFile: for line in newFile: outFile.write('{}\n'.format(line)) if ACTION.prefilter_path or P.lastLoadedProgram != 'None': P.preRflFile = ACTION.prefilter_path or P.lastLoadedProgram ACTION.OPEN_PROGRAM(rflFile) ACTION.prefilter_path = P.preRflFile P.set_run_button_state() txt0 = _translate('HandlerClass', 'RUN FROM LINE') txt1 = _translate('HandlerClass', 'CYCLE START') P.runText = '{}\n{}'.format(txt0, txt1) W.gcodegraphics.highlight_graphics(None)
def __init__(self, name, StatsInfo, row, parent=None): QDialog.__init__(self, parent) print("Inside Attributes Dialog") self.setLayout(QVBoxLayout()) self.setWindowTitle("Table Properties") self.setMinimumSize(600, 250) self.setMaximumSize(600, 250) print(StatsInfo) print("printing row output.......{}".format(row)) StatsDictionary = StatsInfo.iloc[[row]].to_dict() print("stats dictionary below") print(StatsDictionary) print("about to create nominal") Nominal = QLabel("Nominal") Nominal.setMinimumSize(95, 20) NominalValue = QLineEdit(str(StatsDictionary['Nominal'][row])) NominalValue.setMaximumSize(40, 20) print(StatsDictionary['Nominal'][row]) print("nominal has been created") Name = QLabel("Table Name: {}".format(name)) #Tolerance Stats Tolerance = QLabel("Tolerance") Tolerance.setMinimumSize(95, 20) ToleranceValue = QLineEdit(str(StatsDictionary['Tolerance'][row])) ToleranceValue.setMaximumSize(55, 20) print(StatsDictionary['Tolerance'][row]) #Median Median = QLabel("Tolerance") Median.setMinimumSize(95, 20) MedianValue = QLineEdit(str(StatsDictionary['Median'][row])) MedianValue.setMaximumSize(55, 20) print(StatsDictionary['Median'][row]) Mean = QLabel("Mean") Mean.setMinimumSize(95, 20) MeanValue = QLineEdit(str(StatsDictionary['Mean'][row])) MeanValue.setMaximumSize(55, 20) print(StatsDictionary['Mean'][row]) Min = QLabel("Minimum") Min.setMinimumSize(95, 20) MinValue = QLineEdit(str(StatsDictionary['Min'][row])) MinValue.setMaximumSize(55, 20) print(StatsDictionary['Min'][row]) Max = QLabel("Max") Max.setMinimumSize(95, 20) MaxValue = QLineEdit(str(StatsDictionary['Max'][row])) MaxValue.setMaximumSize(55, 20) print(StatsDictionary['Max'][row]) Range = QLabel("Range") Range.setMinimumSize(95, 20) RangeValue = QLineEdit(str(StatsDictionary['Range'][row])) RangeValue.setMaximumSize(55, 20) print(StatsDictionary['Range'][row]) Deviation = QLabel("Deviation") Deviation.setMinimumSize(95, 20) DeviationValue = QLineEdit(str(StatsDictionary['Deviation'][row])) DeviationValue.setMaximumSize(55, 20) print(StatsDictionary['Deviation'][row]) StandardDeviation = QLabel("Standard Deviation") StandardDeviation.setMinimumSize(95, 20) StdDevValue = QLineEdit(str( StatsDictionary['Standard Deviation'][row])) StdDevValue.setMaximumSize(75, 20) print(StatsDictionary['Standard Deviation'][row]) Variance = QLabel("Variance") Variance.setMinimumSize(95, 20) VarianceValue = QLineEdit(str(StatsDictionary['Variance'][row])) VarianceValue.setMaximumSize(75, 20) print(StatsDictionary['Variance'][row]) LowerBound = QLabel("LowerBound") LowerBound.setMinimumSize(95, 20) LowerBoundValue = QLineEdit(str(StatsDictionary['Lower Bound'][row])) LowerBoundValue.setMaximumSize(55, 20) print(StatsDictionary['Lower Bound'][row]) UpperBound = QLabel("UpperBound") UpperBound.setMinimumSize(95, 20) UpperBoundValue = QLineEdit(str(StatsDictionary['Upper Bound'][row])) UpperBoundValue.setMaximumSize(55, 20) print(StatsDictionary['Upper Bound'][row]) self.UpBoundValue = StatsDictionary['Upper Bound'][row] self.LowerBoundValue = StatsDictionary['Upper Bound'][row] #Creating main layouts QH_NameBox = QHBoxLayout() QH_StatsHolder = QHBoxLayout() QSeperator = QHBoxLayout() VboxLeft = QVBoxLayout() VboxRight = QVBoxLayout() self.layout().addLayout(QH_NameBox) self.layout().addLayout(QSeperator) self.layout().addLayout(QH_StatsHolder) QH_NameBox.addWidget(Name) Seperator = QFrame() Seperator.setFrameShape(QFrame.HLine) QSeperator.addWidget(Seperator) QH_StatsHolder.addLayout(VboxLeft) QH_StatsHolder.addLayout(VboxRight) #Adding Stats Data to page # <editor-fold desc="Left Side Statistics"> QNominal = QHBoxLayout() QNominal.addWidget(Nominal) QNominal.addWidget(NominalValue) QNominal.addStretch() VboxLeft.addLayout(QNominal) QTolerance = QHBoxLayout() QTolerance.addWidget(Tolerance) QTolerance.addWidget(ToleranceValue) QTolerance.addStretch() VboxLeft.addLayout(QTolerance) QMean = QHBoxLayout() QMean.addWidget(Mean) QMean.addWidget(MeanValue) QMean.addStretch() VboxLeft.addLayout(QMean) QMedian = QHBoxLayout() QMedian.addWidget(Median) QMedian.addWidget(MedianValue) QMedian.addStretch() VboxLeft.addLayout(QMedian) QMax = QHBoxLayout() QMax.addWidget(Max) QMax.addWidget(MaxValue) QMax.addStretch() VboxLeft.addLayout(QMax) QMin = QHBoxLayout() QMin.addWidget(Min) QMin.addWidget(MinValue) QMin.addStretch() VboxLeft.addLayout(QMin) # </editor-fold> # <editor-fold desc="Right Side Statistics"> QRange = QHBoxLayout() QRange.addWidget(Range) QRange.addWidget(RangeValue) QRange.addStretch() VboxRight.addLayout(QRange) QDeviation = QHBoxLayout() QDeviation.addWidget(Deviation) QDeviation.addWidget(DeviationValue) QDeviation.addStretch() VboxRight.addLayout(QDeviation) QVariance = QHBoxLayout() QVariance.addWidget(Variance) QVariance.addWidget(VarianceValue) QVariance.addStretch() VboxRight.addLayout(QVariance) QStandardDeviation = QHBoxLayout() QStandardDeviation.addWidget(StandardDeviation) QStandardDeviation.addWidget(StdDevValue) QStandardDeviation.addStretch() VboxRight.addLayout(QStandardDeviation) QUpper = QHBoxLayout() QUpper.addWidget(UpperBound) QUpper.addWidget(UpperBoundValue) QUpper.addStretch() VboxRight.addLayout(QUpper) QLower = QHBoxLayout() QLower.addWidget(LowerBound) QLower.addWidget(LowerBoundValue) QLower.addStretch() VboxRight.addLayout(QLower)
def __init__(self, device_list): """Constructor. This class must be executed directly by calling this.exec_().""" QDialog.__init__(self) # Initializing the UI self.__init_UI(device_list)
def __init__(self, parent, exception_text, tribler_version, start_time): QDialog.__init__(self, parent) uic.loadUi(get_ui_file_path('feedback_dialog.ui'), self) self.setWindowTitle("Unexpected error") self.selected_item_index = 0 self.tribler_version = tribler_version self.request_mgr = None # Qt 5.2 does not have the setPlaceholderText property if hasattr(self.comments_text_edit, "setPlaceholderText"): self.comments_text_edit.setPlaceholderText("Comments (optional)") def add_item_to_info_widget(key, value): item = QTreeWidgetItem(self.env_variables_list) item.setText(0, key) item.setText(1, value) self.error_text_edit.setPlainText(exception_text.rstrip()) self.cancel_button.clicked.connect(self.on_cancel_clicked) self.send_report_button.clicked.connect(self.on_send_clicked) # Add machine information to the tree widget add_item_to_info_widget('os.getcwd', '%s' % os.getcwd()) add_item_to_info_widget('sys.executable', '%s' % sys.executable) add_item_to_info_widget('os', os.name) add_item_to_info_widget('platform', sys.platform) add_item_to_info_widget('platform.details', platform.platform()) add_item_to_info_widget('platform.machine', platform.machine()) add_item_to_info_widget('python.version', sys.version) add_item_to_info_widget('indebug', str(__debug__)) add_item_to_info_widget('tribler_uptime', "%s" % (time.time() - start_time)) for argv in sys.argv: add_item_to_info_widget('sys.argv', '%s' % argv) for path in sys.path: add_item_to_info_widget('sys.path', '%s' % path) for key in os.environ.keys(): add_item_to_info_widget('os.environ', '%s: %s' % (key, os.environ[key])) # Add recent requests to feedback dialog request_ind = 1 for endpoint, method, data, timestamp, status_code in sorted( tribler_performed_requests, key=lambda x: x[3])[-30:]: add_item_to_info_widget( 'request_%d' % request_ind, '%s %s %s (time: %s, code: %s)' % (endpoint, method, data, timestamp, status_code())) request_ind += 1 # Add recent events to feedback dialog events_ind = 1 for event, event_time in received_events[:30][::-1]: add_item_to_info_widget( 'event_%d' % events_ind, '%s (time: %s)' % (json.dumps(event), event_time)) events_ind += 1 # Users can remove specific lines in the report self.env_variables_list.customContextMenuRequested.connect( self.on_right_click_item)
def add_product(self): dialog: QDialog = QDialog(self) dialog.ui = UiProductInfo(dialog, self.db_worker) dialog.ui.setup_ui(dialog) dialog.show()
def done(self, r): QDialog.done(self, r) self.close()
def __init__(self): super().__init__() self.rollToBeSearched = 0 self.vbox = QVBoxLayout() self.text = QLabel("Enter the roll no of the student") self.editField = QLineEdit() self.btnSearch = QPushButton("Search", self) self.btnSearch.clicked.connect(self.showStudent) self.vbox.addWidget(self.text) self.vbox.addWidget(self.editField) self.vbox.addWidget(self.btnSearch) self.dialog = QDialog() self.dialog.setWindowTitle("Enter Roll No") self.dialog.setLayout(self.vbox) self.rollForPayment = 0 self.vboxPayment = QVBoxLayout() self.textPayment = QLabel("Enter the roll no of the student") self.editFieldPayment = QLineEdit() self.btnSearchPayment = QPushButton("Search", self) self.btnSearchPayment.clicked.connect(self.showStudentPayment) self.vboxPayment.addWidget(self.textPayment) self.vboxPayment.addWidget(self.editFieldPayment) self.vboxPayment.addWidget(self.btnSearchPayment) self.dialogPayment = QDialog() self.dialogPayment.setWindowTitle("Enter Roll No") self.dialogPayment.setLayout(self.vboxPayment) self.btnEnterStudent = QPushButton("Enter Student Details", self) self.btnEnterPayment = QPushButton("Enter Payment Details", self) self.btnShowStudentDetails = QPushButton("Show Student Details", self) self.btnShowPaymentDetails = QPushButton("Show Payment Details", self) #picture self.picLabel = QLabel(self) self.picLabel.resize(150, 150) self.picLabel.move(120, 20) self.picLabel.setScaledContents(True) self.picLabel.setPixmap(QtGui.QPixmap("user.png")) self.btnEnterStudent.move(15, 170) self.btnEnterStudent.resize(180, 40) self.btnEnterStudentFont = self.btnEnterStudent.font() self.btnEnterStudentFont.setPointSize(13) self.btnEnterStudent.setFont(self.btnEnterStudentFont) self.btnEnterStudent.clicked.connect(self.enterstudent) self.btnEnterPayment.move(205, 170) self.btnEnterPayment.resize(180, 40) self.btnEnterPaymentFont = self.btnEnterStudent.font() self.btnEnterPaymentFont.setPointSize(13) self.btnEnterPayment.setFont(self.btnEnterPaymentFont) self.btnEnterPayment.clicked.connect(self.enterpayment) self.btnShowStudentDetails.move(15, 220) self.btnShowStudentDetails.resize(180, 40) self.btnShowStudentDetailsFont = self.btnEnterStudent.font() self.btnShowStudentDetailsFont.setPointSize(13) self.btnShowStudentDetails.setFont(self.btnShowStudentDetailsFont) self.btnShowStudentDetails.clicked.connect(self.showStudentDialog) self.btnShowPaymentDetails.move(205, 220) self.btnShowPaymentDetails.resize(180, 40) self.btnShowPaymentDetailsFont = self.btnEnterStudent.font() self.btnShowPaymentDetailsFont.setPointSize(13) self.btnShowPaymentDetails.setFont(self.btnShowPaymentDetailsFont) self.btnShowPaymentDetails.clicked.connect( self.showStudentPaymentDialog) self.resize(400, 280) self.setWindowTitle("Student Database Management System")
def ask_child_count(self): dialog = QDialog(self) dialog.ui = ChildCountUi(dialog) dialog.ui.setupUi(dialog) dialog.show()
def showPaymentFunction(list): roll = -1 recipt_no = -1 fee = -1 semester = -1 recipt_date = "" recipt_no = list[0] roll = list[1] fee = list[2] #as I said earlier if semester value is 0 that means Odd semester and if it is 1 then student has paid both semester fees #as we eliminated the possibility of adding Even semester payment record first. if list[3] == 0: semester = "Odd Semester" elif list[3] == 1: semester = "Paid for both Odd and Even Semester" recipt_date = list[4] #we do the same as showing student details. we make a table with 5 rows and 2 columns. #then we create QTableWidgetItem for each box of the grid system. table = QTableWidget() tableItem = QTableWidgetItem() table.setWindowTitle("Student Payment Details") table.setRowCount(5) table.setColumnCount(2) table.setItem(0, 0, QTableWidgetItem("Receipt No")) table.setItem(0, 1, QTableWidgetItem(str(recipt_no))) table.setItem(1, 0, QTableWidgetItem("Roll")) table.setItem(1, 1, QTableWidgetItem(str(roll))) table.setItem(2, 0, QTableWidgetItem("Total Fee")) table.setItem(2, 1, QTableWidgetItem(str(fee))) table.setItem(3, 0, QTableWidgetItem("Semester")) table.setItem(3, 1, QTableWidgetItem(str(semester))) table.setItem(4, 0, QTableWidgetItem("Receipt Date")) table.setItem(4, 1, QTableWidgetItem(str(recipt_date))) table.horizontalHeader().setStretchLastSection(True) table.show() dialog = QDialog() dialog.setWindowTitle("Student Payment Details Details") dialog.resize(500, 300) dialog.setLayout(QVBoxLayout()) dialog.layout().addWidget(table) dialog.exec()
def add_meal(self): dialog: QDialog = QDialog(self) dialog.ui = MealInfoUI(dialog, self.db_worker) dialog.show()
def __init__(self, tx: Transaction, parent: 'ElectrumWindow', invoice, desc, prompt_if_unsaved): '''Transactions in the wallet will show their description. Pass desc to give a description for txs not yet in the wallet. ''' # We want to be a top-level window QDialog.__init__(self, parent=None) # Take a copy; it might get updated in the main window by # e.g. the FX plugin. If this happens during or after a long # sign operation the signatures are lost. self.tx = tx = copy.deepcopy(tx) try: self.tx.deserialize() except BaseException as e: raise SerializationError(e) self.main_window = parent self.wallet = parent.wallet self.prompt_if_unsaved = prompt_if_unsaved self.saved = False self.desc = desc self.invoice = invoice # if the wallet can populate the inputs with more info, do it now. # as a result, e.g. we might learn an imported address tx is segwit, # in which case it's ok to display txid tx.add_inputs_info(self.wallet) self.setMinimumWidth(950) self.setWindowTitle(_("Transaction")) vbox = QVBoxLayout() self.setLayout(vbox) vbox.addWidget(QLabel(_("Transaction ID:"))) self.tx_hash_e = ButtonsLineEdit() qr_show = lambda: parent.show_qrcode( str(self.tx_hash_e.text()), 'Transaction ID', parent=self) qr_icon = "qrcode_white.png" if ColorScheme.dark_scheme else "qrcode.png" self.tx_hash_e.addButton(qr_icon, qr_show, _("Show as QR code")) self.tx_hash_e.setReadOnly(True) vbox.addWidget(self.tx_hash_e) self.add_tx_stats(vbox) vbox.addSpacing(10) self.add_io(vbox) self.sign_button = b = QPushButton(_("Sign")) b.clicked.connect(self.sign) self.broadcast_button = b = QPushButton(_("Broadcast")) b.clicked.connect(self.do_broadcast) self.save_button = b = QPushButton(_("Save")) save_button_disabled = not tx.is_complete() b.setDisabled(save_button_disabled) if save_button_disabled: b.setToolTip(SAVE_BUTTON_DISABLED_TOOLTIP) else: b.setToolTip(SAVE_BUTTON_ENABLED_TOOLTIP) b.clicked.connect(self.save) self.cancel_button = b = QPushButton(_("Close")) b.clicked.connect(self.close) b.setDefault(True) export_actions_menu = QMenu() action = QAction(_("Copy to clipboard"), self) action.triggered.connect(lambda: parent.app.clipboard().setText( (lambda: str(self.tx))())) export_actions_menu.addAction(action) action = QAction(read_QIcon(qr_icon), _("Show as QR code"), self) action.triggered.connect(self.show_qr) export_actions_menu.addAction(action) action = QAction(_("Export to file"), self) action.triggered.connect(self.export) export_actions_menu.addAction(action) self.export_actions_button = QToolButton() self.export_actions_button.setText(_("Export")) self.export_actions_button.setMenu(export_actions_menu) self.export_actions_button.setPopupMode(QToolButton.InstantPopup) # Action buttons self.buttons = [ self.sign_button, self.broadcast_button, self.cancel_button ] # Transaction sharing buttons self.sharing_buttons = [self.export_actions_button, self.save_button] run_hook('transaction_dialog', self) hbox = QHBoxLayout() hbox.addLayout(Buttons(*self.sharing_buttons)) hbox.addStretch(1) hbox.addLayout(Buttons(*self.buttons)) vbox.addLayout(hbox) self.update()
class Window(QMainWindow): def __init__(self): super().__init__() self.rollToBeSearched = 0 self.vbox = QVBoxLayout() self.text = QLabel("Enter the roll no of the student") self.editField = QLineEdit() self.btnSearch = QPushButton("Search", self) self.btnSearch.clicked.connect(self.showStudent) self.vbox.addWidget(self.text) self.vbox.addWidget(self.editField) self.vbox.addWidget(self.btnSearch) self.dialog = QDialog() self.dialog.setWindowTitle("Enter Roll No") self.dialog.setLayout(self.vbox) self.rollForPayment = 0 self.vboxPayment = QVBoxLayout() self.textPayment = QLabel("Enter the roll no of the student") self.editFieldPayment = QLineEdit() self.btnSearchPayment = QPushButton("Search", self) self.btnSearchPayment.clicked.connect(self.showStudentPayment) self.vboxPayment.addWidget(self.textPayment) self.vboxPayment.addWidget(self.editFieldPayment) self.vboxPayment.addWidget(self.btnSearchPayment) self.dialogPayment = QDialog() self.dialogPayment.setWindowTitle("Enter Roll No") self.dialogPayment.setLayout(self.vboxPayment) self.btnEnterStudent = QPushButton("Enter Student Details", self) self.btnEnterPayment = QPushButton("Enter Payment Details", self) self.btnShowStudentDetails = QPushButton("Show Student Details", self) self.btnShowPaymentDetails = QPushButton("Show Payment Details", self) #picture self.picLabel = QLabel(self) self.picLabel.resize(150, 150) self.picLabel.move(120, 20) self.picLabel.setScaledContents(True) self.picLabel.setPixmap(QtGui.QPixmap("user.png")) self.btnEnterStudent.move(15, 170) self.btnEnterStudent.resize(180, 40) self.btnEnterStudentFont = self.btnEnterStudent.font() self.btnEnterStudentFont.setPointSize(13) self.btnEnterStudent.setFont(self.btnEnterStudentFont) self.btnEnterStudent.clicked.connect(self.enterstudent) self.btnEnterPayment.move(205, 170) self.btnEnterPayment.resize(180, 40) self.btnEnterPaymentFont = self.btnEnterStudent.font() self.btnEnterPaymentFont.setPointSize(13) self.btnEnterPayment.setFont(self.btnEnterPaymentFont) self.btnEnterPayment.clicked.connect(self.enterpayment) self.btnShowStudentDetails.move(15, 220) self.btnShowStudentDetails.resize(180, 40) self.btnShowStudentDetailsFont = self.btnEnterStudent.font() self.btnShowStudentDetailsFont.setPointSize(13) self.btnShowStudentDetails.setFont(self.btnShowStudentDetailsFont) self.btnShowStudentDetails.clicked.connect(self.showStudentDialog) self.btnShowPaymentDetails.move(205, 220) self.btnShowPaymentDetails.resize(180, 40) self.btnShowPaymentDetailsFont = self.btnEnterStudent.font() self.btnShowPaymentDetailsFont.setPointSize(13) self.btnShowPaymentDetails.setFont(self.btnShowPaymentDetailsFont) self.btnShowPaymentDetails.clicked.connect( self.showStudentPaymentDialog) self.resize(400, 280) self.setWindowTitle("Student Database Management System") def enterstudent(self): enterStudent = AddStudent() def enterpayment(self): enterpayment = AddPayment() def showStudentDialog(self): self.dialog.exec() def showStudentPaymentDialog(self): self.dialogPayment.exec() def showStudent(self): if self.editField.text() is "": QMessageBox.warning( QMessageBox(), 'Error', 'You must give the roll number to show the results for.') return None showstudent = DBHelper() showstudent.searchStudent(int(self.editField.text())) def showStudentPayment(self): if self.editFieldPayment.text() is "": QMessageBox.warning( QMessageBox(), 'Error', 'You must give the roll number to show the results for.') return None showstudent = DBHelper() showstudent.searchPayment(int(self.editFieldPayment.text()))
import sys from PyQt5.QtWidgets import QApplication, QDialog from Dialogs.MainWindow import Ui_MainWindow from Classes.TCPThread import TCPThread if __name__ == '__main__': app = QApplication(sys.argv) Dialog = QDialog() ui = Ui_MainWindow() ui.setupUi(Dialog) socketThread = TCPThread(1, "Thread-1", 1) socketThread.subscribe(ui) socketThread.daemon = True socketThread.start() Dialog.show() sys.exit(app.exec_())
def showStudent(list): roll = 0 gender = "" branch = "" year = "" name = "" address = "" mobile = -1 academic_year = -1 roll = list[0] name = list[1] if list[2] == 0: gender = "Male" else: gender = "Female" if list[3] == 0: branch = "Mechanical Engineering" elif list[3] == 1: branch = "Civil Engineering" elif list[3] == 2: branch = "Electrical Engineering" elif list[3] == 3: branch = "Electronics and Communication Engineering" elif list[3] == 4: branch = "Computer Science and Engineering" elif list[3] == 5: branch = "Information Technology" if list[4] == 0: year = "1st" elif list[4] == 1: year = "2nd" elif list[4] == 2: year = "3rd" elif list[4] == 3: year = "4th" academic_year = list[5] address = list[6] mobile = list[7] #we make the table here. Table has eight rows and 2 columns. #in PyQt tables are like grids. you have to place each QTableWidgetItem seprately corresponding to the grid system with x and y # both starting at 0 index. Then we populate the table with values from the passed list as we got all of them above. table = QTableWidget() tableItem = QTableWidgetItem() table.setWindowTitle("Student Details") table.setRowCount(8) table.setColumnCount(2) table.setItem(0, 0, QTableWidgetItem("Roll")) table.setItem(0, 1, QTableWidgetItem(str(roll))) table.setItem(1, 0, QTableWidgetItem("Name")) table.setItem(1, 1, QTableWidgetItem(str(name))) table.setItem(2, 0, QTableWidgetItem("Gender")) table.setItem(2, 1, QTableWidgetItem(str(gender))) table.setItem(3, 0, QTableWidgetItem("Branch")) table.setItem(3, 1, QTableWidgetItem(str(branch))) table.setItem(4, 0, QTableWidgetItem("Year")) table.setItem(4, 1, QTableWidgetItem(str(year))) table.setItem(5, 0, QTableWidgetItem("Academic Year")) table.setItem(5, 1, QTableWidgetItem(str(academic_year))) table.setItem(6, 0, QTableWidgetItem("Address")) table.setItem(6, 1, QTableWidgetItem(str(address))) table.setItem(7, 0, QTableWidgetItem("Mobile")) table.setItem(7, 1, QTableWidgetItem(str(mobile))) table.horizontalHeader().setStretchLastSection(True) table.show() dialog = QDialog() dialog.setWindowTitle("Student Details") dialog.resize(500, 300) dialog.setLayout(QVBoxLayout()) dialog.layout().addWidget(table) dialog.exec()
def settingseditor(self): """ Opens the settings manager dialog, then applies the change""" dialog = QDialog(self) websettingsdialog = Ui_SettingsDialog() websettingsdialog.setupUi(dialog) # Enable AdBlock websettingsdialog.checkAdBlock.setChecked(webkit.enable_adblock) # Fonts blocking websettingsdialog.checkFontLoad.setChecked(webkit.block_fonts) # Popups blocking websettingsdialog.checkBlockPopups.setChecked(webkit.block_popups) # Custom user agent websettingsdialog.useragentEdit.setText(webkit.useragent_custom) # External download manager websettingsdialog.checkDownMan.setChecked(self.useexternaldownloader) websettingsdialog.downManEdit.setText(self.externaldownloader) # RTSP media player command websettingsdialog.mediaPlayerEdit.setText(webkit.video_player_command) websettingsdialog.mediaPlayerEdit.setCursorPosition(0) # Font settings websettingsdialog.spinFontSize.setValue(self.minfontsizeval) websettingsdialog.standardfontCombo.setCurrentFont( QFont(self.standardfontval)) websettingsdialog.sansfontCombo.setCurrentFont(QFont(self.sansfontval)) websettingsdialog.seriffontCombo.setCurrentFont( QFont(self.seriffontval)) websettingsdialog.fixedfontCombo.setCurrentFont( QFont(self.fixedfontval)) # Clear Data buttons websettingsdialog.clearCacheButton.clicked.connect( self.websettings.clearMemoryCaches) websettingsdialog.cookiesButton.clicked.connect(cookiejar.clearCookies) websettingsdialog.iconDBButton.clicked.connect( self.websettings.clearIconDatabase) if dialog.exec_() == QDialog.Accepted: # Enable AdBlock webkit.enable_adblock = websettingsdialog.checkAdBlock.isChecked() # Block Fonts webkit.block_fonts = websettingsdialog.checkFontLoad.isChecked() # Block Popups webkit.block_popups = websettingsdialog.checkBlockPopups.isChecked( ) # User Agent webkit.useragent_custom = websettingsdialog.useragentEdit.text() # Download Manager self.useexternaldownloader = websettingsdialog.checkDownMan.isChecked( ) self.externaldownloader = websettingsdialog.downManEdit.text() # Media Player Command webkit.video_player_command = websettingsdialog.mediaPlayerEdit.text( ) self.minfontsizeval = websettingsdialog.spinFontSize.value() self.standardfontval = websettingsdialog.standardfontCombo.currentText( ) self.sansfontval = websettingsdialog.sansfontCombo.currentText() self.seriffontval = websettingsdialog.seriffontCombo.currentText() self.fixedfontval = websettingsdialog.fixedfontCombo.currentText() self.applysettings() self.savesettings()
def sizeHint(self): sh = QDialog.sizeHint(self) sh.setWidth(self.width()) return sh
def __init__(self, parent): QDialog.__init__(self, parent) self.folder = downloaddir self.setupUi(self) self.folderButton.clicked.connect(self.changeFolder) self.labelFolder.setText(downloaddir)
def __init__(self, parent, title=None): QDialog.__init__(self, parent) self.setWindowModality(Qt.WindowModal) if title: self.setWindowTitle(title)
def showEvent(self, event): if self.mode == "create": self.browsePath() return QDialog.showEvent(self, event)
def download_manager(self): """ Opens download manager dialog """ dialog = QDialog(self) downloads_dialog = Downloads_Dialog() downloads_dialog.setupUi(dialog, self.dwnldsmodel) dialog.exec_()
def showInventoryInfo(self): """ Uses QDialog to display inventory information pulled from game """ inventoryInfo = self.game.currentInventoryDictionary() equippedInfo = self.game.currentEquippedAll() weaponString = "" armorString = "" miscString = "" equippedString = "" for item, amount in inventoryInfo.items(): if isinstance(item, Items.Weapon): weaponString += (item.name + ": Quantity: " + str(amount) + "\n" + item.description + "\n\n") elif isinstance(item, Items.Armor): armorString += (item.name + ": Quantity: " + str(amount) + "\n" + item.description + "\n\n") else: miscString += (item.name + ": Quantity: " + str(amount) + "\n" + item.description + "\n\n\n") for equipped in equippedInfo: if equipped is not None: equippedString += equipped.name + "\n" invInfoDialog = QDialog() invInfoDialog.setWindowTitle("Inventory") invDialogVBoxLayout = QVBoxLayout() weaponLabel = QLabel() weaponLabel.setText("Weapons: ") weaponLabel.setAlignment(Qt.AlignCenter) weaponStringLabel = QLabel() weaponStringLabel.setText(weaponString) armorLabel = QLabel() armorLabel.setText("Armor: ") armorLabel.setAlignment(Qt.AlignCenter) armorStringLabel = QLabel() armorStringLabel.setText(armorString) miscLabel = QLabel() miscLabel.setText("Miscellaneous") miscLabel.setAlignment(Qt.AlignCenter) miscStringLabel = QLabel() miscStringLabel.setText(miscString) equippedLabel = QLabel() equippedLabel.setText("Equipped") equippedLabel.setAlignment(Qt.AlignCenter) equippedStringLabel = QLabel() equippedStringLabel.setText(equippedString) okPushButton = QPushButton("Ok") okPushButton.clicked.connect(invInfoDialog.accept) invDialogVBoxLayout.addWidget(weaponLabel) invDialogVBoxLayout.addWidget(weaponStringLabel) invDialogVBoxLayout.addWidget(armorLabel) invDialogVBoxLayout.addWidget(armorStringLabel) invDialogVBoxLayout.addWidget(miscLabel) invDialogVBoxLayout.addWidget(miscStringLabel) invDialogVBoxLayout.addWidget(equippedLabel) invDialogVBoxLayout.addWidget(equippedStringLabel) invDialogVBoxLayout.addWidget(okPushButton) invInfoDialog.setLayout(invDialogVBoxLayout) if (invInfoDialog.exec() == invInfoDialog.Accepted): pass
def __init__(self, parent): QDialog.__init__(self, parent) self.setupUi(self) self.txtLink.setFocus(Qt.OtherFocusReason)
class Updater(QObject): installed = pyqtSignal() _latest_release: Release = Release() _releases: List[Release] = [] _updates: List[Release] = [] _silent = False def __init__(self, parent, feed: Feed) -> None: super().__init__(parent) self._parent = parent self.dialog = QDialog(parent) self.ui = UpdaterUi(self.dialog) self.dialog.ui = self.ui self.feed = feed def _showDialog(self): screen_geometry = QApplication.desktop().screenGeometry() x = (screen_geometry.width() - self.dialog.width()) / 2 y = (screen_geometry.height() - self.dialog.height()) / 2.8 self.dialog.move(x, y) self.dialog.show() def checkForUpdate(self, silent=False): """ Check for new update, if yes, then show the update confirmation window :param silent: whether or not we show the loading window """ self._silent = silent if not silent: self._showDialog() self.setupLoadingUi() self.feed.ready.connect(self.handleFeedReady) logger.info("Starting to fetch update info...") self.feed.load() def handleFeedReady(self): release = Release(QApplication.applicationVersion()) self._updates = self.feed.getUpdates(release) if len(self._updates) > 0: self._latest_release = self._updates[0] if len(self._updates) == 0: self.setupNoUpdatesUi() logger.info("No release found.") return latest_version = self._latest_release.getVersion() skip_release = setting_service.getSettingsValue( SKIP_RELEASE) == latest_version if latest_version: self.setupUpdateUi() if self._silent and not skip_release: self._showDialog() def setIcon(self, pixmap: QPixmap): self.ui.label_icon.setPixmap(pixmap) self.ui.label_icon.setHidden(False) def setupNoUpdatesUi(self): if self._silent: return self.resetUi() self.dialog.setMinimumSize(QSize(rt(500), rt(120))) self.dialog.resize(rt(500), rt(120)) show_widgets = [ self.ui.label_info_no_updates, self.ui.button_confirm, self.ui.label_headline_no_updates, self.ui.main_container, self.ui.label_icon ] for widget in show_widgets: widget.show() self.ui.button_confirm.setFocus() self.ui.label_headline_no_updates.setText( self.replaceAppVars(self.ui.label_headline_no_updates.text())) self.ui.button_confirm.clicked.connect(self.dialog.accept) self.dialog.adjustSize() def startDownload(self): logger.info("Starting to download release %s..." % self._latest_release.version) self.feed.downloadRelease(self._latest_release) self.disableButtons(True) def setupUpdateUi(self): self.resetUi() self.ui.label_icon.show() self.dialog.setMinimumSize(QSize(rt(346 * 2), rt(346))) self.dialog.resize(rt(346 * 2), rt(346)) show_widgets = [ self.ui.main_container, self.ui.label_changelog, self.ui.button_skip, self.ui.button_cancel, self.ui.button_install, self.ui.label_info, self.ui.release_notes, self.ui.label_headline ] for widget in show_widgets: widget.show() labels = [self.ui.label_headline, self.ui.label_info] for label in labels: label.setText(self.replaceAppVars(label.text())) self.ui.label_changelog.setHtml( release_utils.generateChangelogDocument(self._updates)) self.ui.label_changelog.setOpenExternalLinks(True) self.ui.label_changelog.setReadOnly(True) self.ui.button_confirm.clicked.connect(self.dialog.accept) self.ui.button_skip.clicked.connect(self.skipRelease) self.ui.button_cancel.clicked.connect(self.dialog.reject) self.ui.button_install.setFocus() self.ui.button_install.clicked.connect(self.onButtonInstall) self.dialog.adjustSize() def onButtonInstall(self): self.setupDownloadingUi() self.feed.download_finished.connect(self.handleDownloadFinished) self.feed.download_error.connect(self.handleDownloadError) self.feed.download_progress.connect(self.updateProgressBar) self.startDownload() def skipRelease(self): setting_service.setSettingsValue(SKIP_RELEASE, self._latest_release.getVersion()) self.dialog.reject() def handleDownloadFinished(self): self.setupInstallingUi() def handleDownloadError(self, message): message_box = QMessageBox(self.dialog) message_box.setIcon(QMessageBox.Warning) message_box.setText( self.tr("There was an error while downloading the update.")) message_box.setInformativeText(message) message_box.show() self.dialog.reject() def disableButtons(self, disable: bool): buttons = [ self.ui.button_cancel, self.ui.button_confirm, self.ui.button_install, self.ui.button_skip ] for button in buttons: button.setDisabled(disable) def setupLoadingUi(self): if self._silent: return self.resetUi() self.dialog.setMinimumSize(QSize(rt(500), rt(120))) self.dialog.resize(rt(500), rt(120)) self.ui.main_container.show() self.ui.label_headline_loading.show() self.ui.progress_bar.show() self.ui.progress_bar.setMaximum(0) self.ui.progress_bar.setMinimum(0) self.ui.label_icon.show() self.dialog.adjustSize() def setupDownloadingUi(self): self.resetUi() self.dialog.setWindowTitle( self.tr("Updating") + " %s…" % QApplication.applicationName()) self.dialog.setMinimumSize(QSize(rt(500), rt(120))) self.dialog.resize(rt(500), rt(120)) show_widgets = [ self.ui.main_container, self.ui.label_icon, self.ui.progress_bar, self.ui.label_downloading, self.ui.button_cancel_loading, self.ui.progress_label ] for widget in show_widgets: widget.show() self.ui.button_cancel_loading.setEnabled(True) self.ui.button_cancel_loading.setFocus() self.ui.button_cancel_loading.clicked.connect(self.dialog.reject) self.dialog.adjustSize() def setupInstallingUi(self): self.resetUi() self.dialog.setWindowTitle( self.tr("Updating") + " %s…" % QApplication.applicationName()) self.dialog.setMinimumSize(QSize(rt(500), rt(120))) self.dialog.resize(rt(500), rt(120)) show_widgets = [ self.ui.main_container, self.ui.label_icon, self.ui.button_install_and_relaunch, self.ui.label_install_and_relaunch ] for widget in show_widgets: widget.show() self.updateProgressBar(self._latest_release.download_size, self._latest_release.download_size) self.ui.button_install_and_relaunch.setEnabled(True) self.ui.button_install_and_relaunch.setFocus() self.ui.button_install_and_relaunch.clicked.connect(self.installUpdate) self.dialog.adjustSize() def installUpdate(self): logger.info("Starting to install update...") file = self.feed.getDownloadFile() worker = Worker(core.installUpdate, file) worker.signals.result.connect(self.onInstalled) worker.signals.error.connect(lambda x: self.setupInstallFailedUi()) threadpool.start(worker) def onInstalled(self): self.installed.emit() self.dialog.accept() def setupInstallFailedUi(self): self.resetUi() self.dialog.setMinimumSize(QSize(rt(500), rt(120))) self.dialog.resize(rt(500), rt(120)) show_widgets = [ self.ui.main_container, self.ui.label_icon, self.ui.label_info_unable_update, self.ui.label_headline_unable_update ] for widget in show_widgets: widget.show() self.ui.label_info_unable_update.setText( self.replaceAppVars(self.ui.label_info_unable_update.text())) self.dialog.adjustSize() def resetUi(self): hidden_widgets = [ self.ui.main_container, self.ui.label_icon, self.ui.label_headline_loading, self.ui.label_info, self.ui.release_notes, self.ui.button_install_and_relaunch, self.ui.label_headline, self.ui.label_downloading, self.ui.label_install_and_relaunch, self.ui.label_info_no_updates, self.ui.label_headline_no_updates, self.ui.label_headline_unable_update, self.ui.label_info_unable_update, self.ui.label_changelog, self.ui.progress_bar, self.ui.button_skip, self.ui.button_cancel, self.ui.button_cancel_loading, self.ui.button_confirm, self.ui.button_install, self.ui.progress_label ] for widget in hidden_widgets: widget.hide() pyqt_utils.disconnectAllSignals(widget) self.ui.progress_bar.reset() self.dialog.adjustSize() def replaceAppVars(self, string): new_str = string.replace("$APP_NAME$", QCoreApplication.applicationName()) new_str = new_str.replace("$CURRENT_VERSION$", QCoreApplication.applicationVersion()) new_str = new_str.replace("$UPDATE_VERSION$", self._latest_release.getVersion()) new_str = new_str.replace("$UPDATE_LINK$", self._latest_release.getDownloadUrl()) return new_str def updateProgressBar(self, bytes_received, bytes_total): self.ui.progress_bar.show() self.ui.progress_bar.setMaximum(bytes_total / 1024) self.ui.progress_bar.setValue(bytes_received / 1024) self.ui.progress_label.show() mb_received = bytes_received / 1024 / 1024 mb_total = bytes_total / 1024 / 1024 self.ui.progress_label.setText("%.2f MB of %.2f MB" % (mb_received, mb_total))
def __init__(self, parent): QDialog.__init__(self, parent) self.setupUi(self) self.makeConnections()
def keyPressEvent(self, event): self.process_key(event.key()) if not self.data: QDialog.keyPressEvent(self, event)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_IMDBSearchDialog() self.setup_ui()