Python PyQt5.QtWidgets.QDialog() Examples
The following are 30
code examples of PyQt5.QtWidgets.QDialog().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: simulation_menu.py From simnibs with GNU General Public License v3.0 | 7 votes |
def selectFile(self): if self.fname is not None and os.path.isfile(self.fname): eeg_cap_dir = os.path.dirname(self.fname) else: eeg_cap_dir = QtCore.QDir.currentPath() dialog = QtWidgets.QFileDialog(self) dialog.setWindowTitle('Open EEG Position file') dialog.setNameFilter('(*.csv)') dialog.setDirectory(eeg_cap_dir) dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile) filename = None if dialog.exec_() == QtWidgets.QDialog.Accepted: filename = dialog.selectedFiles() if filename: self.fname = str(filename[0]) self.group_box.lineEdit.setText(self.fname)
Example #2
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
def __init__(self): """ Creates and initializes the dialog """ QtWidgets.QDialog.__init__(self) self.setWindowTitle('Choose Object') self.objNum = QtWidgets.QSpinBox() count = len(Tileset.objects) - 1 self.objNum.setRange(0, count) self.objNum.setValue(0) buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) mainLayout = QtWidgets.QVBoxLayout() mainLayout.addWidget(self.objNum) mainLayout.addWidget(buttonBox) self.setLayout(mainLayout)
Example #3
Source File: window.py From visma with GNU General Public License v3.0 | 6 votes |
def popupBrowser(self): w = QDialog(self) w.resize(600, 500) w.setWindowTitle('Wiki') web = QWebEngineView(w) web.load(QUrl('https://github.com/aerospaceresearch/visma/wiki')) web.resize(600, 500) web.show() w.show()
Example #4
Source File: main_gui.py From IDAngr with BSD 2-Clause "Simplified" License | 6 votes |
def get_mem(addr): dialog = IDAngrAddMemDialog() dialog.set_addr(addr) r = dialog.exec_() if r == QtWidgets.QDialog.Accepted: addr = dialog.ui.addrTextEdit.displayText() try: addr = int(addr, 16) except: QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, 'Error', "Address not in hex format").exec_() return None length = dialog.ui.lenTextEdit.displayText() try: length = int(length) except: QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, 'Error', "Length not in dec format").exec_() return None return (addr, length) return None
Example #5
Source File: main_gui.py From simnibs with GNU General Public License v3.0 | 6 votes |
def openSimulation(self): dialog = QtWidgets.QFileDialog(self) dialog.setWindowTitle('Open GMSH File') dialog.setNameFilter('GMSH files (*.msh)') dialog.setDirectory(QtCore.QDir.currentPath()) dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile) if dialog.exec_() == QtWidgets.QDialog.Accepted: file_full_path = str(dialog.selectedFiles()[0]) else: return None self.thread = openGmshThread(file_full_path) self.thread.start() #Generates a sim_struct.session() structure, for saving and running
Example #6
Source File: main_gui.py From simnibs with GNU General Public License v3.0 | 6 votes |
def coilDialog(self): #get folder with ccd files try: ccd_folder = os.path.join(SIMNIBSDIR, 'ccd-files') except: ccd_folder = './' dialog = QtWidgets.QFileDialog(self) dialog.setWindowTitle('Open Coil Definition File') dialog.setNameFilter('Coil Definition files (*.ccd *.nii *.gz)') dialog.setDirectory(ccd_folder) dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile) if dialog.exec_() == QtWidgets.QDialog.Accepted: fn = str(dialog.selectedFiles()[0]) else: return None self.tmslist.fnamecoil = fn self.coil_line_edit.setText(fn)
Example #7
Source File: init_gui.py From IDAngr with BSD 2-Clause "Simplified" License | 6 votes |
def __init__(self): QtWidgets.QDialog.__init__(self) self.ui = Ui_IDAngrConnectDialog() self.ui.setupUi(self) host = "localhost" port = manage.DEFAULT_SERVER_PORT try: if os.path.exists(config_file): with open(config_file) as f: config = json.load(f) host = config["host"] port = config["port"] self.ui.saveBox.setChecked(config["save"]) self.ui.localBox.setChecked(config["local"]) except: pass self.ui.hostTxt.setText(host) self.ui.portTxt.setText(str(port))
Example #8
Source File: tool_dialogs.py From kite with GNU General Public License v3.0 | 6 votes |
def __init__(self, sandbox, *args, **kwargs): QtWidgets.QDialog.__init__(self, *args, **kwargs) loadUi(get_resource('dialog_los.ui'), self) self.setSizeGripEnabled(False) self.move( self.parent().window().mapToGlobal( self.parent().window().rect().center()) - self.mapToGlobal(self.rect().center())) self.sandbox = sandbox model = self.sandbox.model self.applyButton.released.connect(self.updateValues) self.okButton.released.connect(self.updateValues) self.okButton.released.connect(self.close) self.setValues()
Example #9
Source File: clrapplier.py From IDASkins with MIT License | 6 votes |
def eventFilter(self, obj, event): def is_colors_dialog(): return isinstance( obj, QDialog) and 'IDA Colors' in obj.windowTitle() if isinstance(event, QShowEvent) and is_colors_dialog(): qApp.removeEventFilter(self) # Hide window and find &Import button obj.windowHandle().setOpacity(0) buttons = [widget for widget in obj.children() if isinstance( widget, QDialogButtonBox)][0] button = [widget for widget in buttons.buttons() if widget.text() == '&Import'][0] with NativeHook(ask_file=self.ask_file_handler): button.click() QTimer.singleShot(0, lambda: obj.accept()) return 1 return 0
Example #10
Source File: main_gui.py From IDAngr with BSD 2-Clause "Simplified" License | 6 votes |
def __init__(self): global _idangr_ctx QtWidgets.QDialog.__init__(self) self.ui = Ui_IDAngrExecDialog() self.ui.setupUi(self) if _idangr_ctx.find_lambda: self.ui.findCondEdit.setPlainText(_idangr_ctx.find_lambda) if _idangr_ctx.avoid_lambda: self.ui.avoidCondEdit.setPlainText(_idangr_ctx.avoid_lambda) self.ui.simprocsBox.setChecked(get_memory_type() == SIMPROCS_FROM_CLE) self.ui.textloaderBox.setChecked(get_memory_type() == USE_CLE_MEMORY) self.ui.gotloaderBox.setChecked(get_memory_type() == ONLY_GOT_FROM_CLE) self.ui.execallBox.setChecked(get_memory_type() == GET_ALL_DISCARD_CLE) self.fh = PythonHighlighter(self.ui.findCondEdit.document()) self.ah = PythonHighlighter(self.ui.avoidCondEdit.document())
Example #11
Source File: breathing_phrase_list_wt.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 6 votes |
def add_new_phrase_button_clicked(self): text_sg = self.add_to_list_qle.text().strip() # strip is needed to remove a newline at the end (why?) if not (text_sg and text_sg.strip()): conf_result_bool = mc.gui.warning_dlg.WarningDlg.get_safe_confirmation_dialog( self.tr("You have to write an item before you press 'Add'.") ) return mc.model.PhrasesM.add( text_sg, BREATHING_IN_DEFAULT_PHRASE, BREATHING_OUT_DEFAULT_PHRASE, BREATHING_IN_DEFAULT_SHORT_PHRASE, BREATHING_OUT_DEFAULT_SHORT_PHRASE, mc.mc_global.BreathingPhraseType.in_out ) self.add_to_list_qle.clear() self.update_gui() self.list_widget.setCurrentRow(self.list_widget.count() - 1) # self.in_breath_phrase_qle.setFocus() # if dialog_result == QtWidgets.QDialog.Accepted: self.edit_dialog = EditDialog() self.edit_dialog.finished.connect(self.on_edit_dialog_finished) self.edit_dialog.show()
Example #12
Source File: UI_corriente.py From pychemqt with GNU General Public License v3.0 | 6 votes |
def repaint(self, psychro=True): # Parameter to avoid recursive repaint if self.semaforo.available() > 0: self.semaforo.acquire(1) self.pageDefinition.setStream(self.corriente) self.pageConfig.setKwargs(self.corriente.kwargs) if psychro and self.psychro: psystream = self.corriente.psystream self.pagePsychro.setStream(psystream) self.pageSolids.setSolido(self.corriente.solido) self.PageNotas.setText(self.corriente.notas) self.pageProperties.fill(self.corriente) if isinstance(self, QtWidgets.QDialog): self.status.setState(self.corriente.status, self.corriente.msg) if self.corriente.status == 1: self.Changed.emit(self.corriente) self.semaforo.release(1)
Example #13
Source File: costIndex.py From pychemqt with GNU General Public License v3.0 | 6 votes |
def accept(self): """Overwrite accept signal to save changes""" with open(config.conf_dir+"CostIndex.dat", "w") as archivo: if self.custom: archivo.write("custom\n") else: archivo.write(self.fecha.currentText()+"\n") archivo.write(str(self.index.value)+"\n") archivo.write(str(self.equipos.value)+"\n") archivo.write(str(self.cambiadores_calor.value)+"\n") archivo.write(str(self.maquinaria.value)+"\n") archivo.write(str(self.tuberias.value)+"\n") archivo.write(str(self.instrumentos.value)+"\n") archivo.write(str(self.bombas.value)+"\n") archivo.write(str(self.equipos_electricos.value)+"\n") archivo.write(str(self.soportes.value)+"\n") archivo.write(str(self.construccion.value)+"\n") archivo.write(str(self.edificios.value)+"\n") archivo.write(str(self.ingenieria.value)+"\n") QtWidgets.QDialog.accept(self)
Example #14
Source File: labelDialog.py From CNNArt with Apache License 2.0 | 5 votes |
def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate self.setWindowTitle(_translate("Dialog", "Choose label")) # import configGUI.resrc_rc # # if __name__ == "__main__": # import sys # app = QtWidgets.QApplication(sys.argv) # labelDialog = QtWidgets.QDialog() # labelDialog.show() # sys.exit(app.exec_())
Example #15
Source File: UnfinishedDownloadsDialog.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def __init__(self): """The unfinished dialog box setup class""" QtWidgets.QDialog.__init__(self) self.setupUi(self) self.close_and_keep_button.clicked.connect(self.close) self.close_and_delete_button.clicked.connect(self.close) self.download_button.clicked.connect(self.close)
Example #16
Source File: universal_tool_template_0903.py From universal_tool_template.py with MIT License | 5 votes |
def setupWin(self): super(self.__class__,self).setupWin() self.setGeometry(500, 300, 250, 110) # self.resize(250,250) #------------------------------ # template list: for frameless or always on top option #------------------------------ # - template : keep ui always on top of all; # While in Maya, dont set Maya as its parent ''' self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ''' # - template: hide ui border frame; # While in Maya, use QDialog instead, as QMainWindow will make it disappear ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint) ''' # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) ''' # - template: for transparent and non-regular shape ui # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window # note: black color better than white for better look of semi trans edge, like pre-mutiply ''' self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setStyleSheet("background-color: rgba(0, 0, 0,0);") '''
Example #17
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
def setupWin(self): super(self.__class__,self).setupWin() self.setGeometry(500, 300, 250, 110) # self.resize(250,250) #------------------------------ # template list: for frameless or always on top option #------------------------------ # - template : keep ui always on top of all; # While in Maya, dont set Maya as its parent ''' self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ''' # - template: hide ui border frame; # While in Maya, use QDialog instead, as QMainWindow will make it disappear ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint) ''' # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui ''' self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) ''' # - template: for transparent and non-regular shape ui # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window # note: black color better than white for better look of semi trans edge, like pre-mutiply ''' self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setStyleSheet("background-color: rgba(0, 0, 0,0);") '''
Example #18
Source File: GearBox_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
def setupUI(self, layout='grid'): #------------------------------ # main_layout auto creation for holding all the UI elements #------------------------------ main_layout = None if isinstance(self, QtWidgets.QMainWindow): main_widget = QtWidgets.QWidget() self.setCentralWidget(main_widget) main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size main_widget.setLayout(main_layout) else: # main_layout for QDialog main_layout = self.quickLayout(layout, 'main_layout') self.setLayout(main_layout)
Example #19
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def setupUI(self): #------------------------------ # main_layout auto creation for holding all the UI elements #------------------------------ main_layout = None if isinstance(self, QtWidgets.QMainWindow): main_widget = QtWidgets.QWidget() self.setCentralWidget(main_widget) main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size main_widget.setLayout(main_layout) else: # main_layout for QDialog main_layout = self.quickLayout('vbox', 'main_layout') self.setLayout(main_layout) #------------------------------ # user ui creation part #------------------------------ # + template: qui version since universal tool template v7 # - no extra variable name, all text based creation and reference self.qui('dict_table | source_txtEdit | result_txtEdit','info_split;v') self.qui('filePath_input | fileLoad_btn;Load | fileLang_choice | fileExport_btn;Export', 'fileBtn_layout;hbox') self.qui('info_split | process_btn;Process and Update Memory From UI | fileBtn_layout', 'main_layout') self.uiList["source_txtEdit"].setWrap(0) self.uiList["result_txtEdit"].setWrap(0) #------------- end ui creation -------------------- for name,each in self.uiList.items(): if isinstance(each, QtWidgets.QLayout) and name!='main_layout' and not name.endswith('_grp_layout'): each.setContentsMargins(0,0,0,0) # clear extra margin some nested layout #self.quickInfo('Ready')
Example #20
Source File: universal_tool_template_0903.py From universal_tool_template.py with MIT License | 5 votes |
def setupUI(self): #------------------------------ # main_layout auto creation for holding all the UI elements #------------------------------ main_layout = None if isinstance(self, QtWidgets.QMainWindow): main_widget = QtWidgets.QWidget() self.setCentralWidget(main_widget) main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size main_widget.setLayout(main_layout) else: # main_layout for QDialog main_layout = self.quickLayout('vbox', 'main_layout') self.setLayout(main_layout)
Example #21
Source File: RedditAccountDialog.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def __init__(self): QtWidgets.QDialog.__init__(self) self.setupUi(self) self.reddit_account_help_button.clicked.connect(self.help_dialog) self.save_cancel_button_box.accepted.connect(self.accept) self.save_cancel_button_box.rejected.connect(self.close)
Example #22
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def saveObject(self): if len(Tileset.objects) == 0: return dlg = getObjNum() if dlg.exec_() == QtWidgets.QDialog.Accepted: n = dlg.objNum.value() file = QtWidgets.QFileDialog.getSaveFileName(None, "Save Objects", "", "Object files (*.json)")[0] if not file: return name = os.path.splitext(file)[0] baseName = os.path.basename(name) self.exportObject(name, baseName, n)
Example #23
Source File: heatTransfer.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def resizeEvent(self, event): """Implement resizeEvent to precalculate the new position of image""" self.refixImage() QtWidgets.QDialog.resizeEvent(self, event)
Example #24
Source File: UI_corriente.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def calculo(self, variable, valor): if self.semaforo.available() > 0: if isinstance(self, QtWidgets.QDialog): self.status.setState(4) kwargs = self.pageConfig.kwargs kwargs[variable] = valor self.salida(**kwargs)
Example #25
Source File: newComponent.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def save(self): """Save new componente in user database""" elemento = self.unknown.export2Component() sql.inserElementsFromArray(sql.databank_Custom_name, [elemento]) Dialog = View_Component(1001+sql.N_comp_Custom) Dialog.show() QtWidgets.QDialog.accept(self)
Example #26
Source File: QtShim.py From grap with MIT License | 5 votes |
def get_QDialog(): """QDialog getter.""" try: import PySide.QtGui as QtGui return QtGui.QDialog except ImportError: import PyQt5.QtWidgets as QtWidgets return QtWidgets.QDialog
Example #27
Source File: config.py From kite with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): QtWidgets.QDialog.__init__(self, *args, **kwargs) self.completer = QtWidgets.QCompleter() self.completer_model = QtWidgets.QFileSystemModel(self.completer) self.completer.setModel(self.completer_model) self.completer.setMaxVisibleItems(8) loadUi(get_resource('dialog_config.ui'), self) self.ok_button.released.connect( self.setAttributes) self.ok_button.released.connect( self.close) self.apply_button.released.connect( self.setAttributes) self.vector_color_picker = QtWidgets.QColorDialog(self) self.vector_color_picker. \ setCurrentColor(QtGui.QColor(*getConfig().vector_color)) self.vector_color_picker. \ setOption(self.vector_color_picker.ShowAlphaChannel) self.vector_color_picker.colorSelected.connect( self.updateVectorColor) self.vector_color_picker.setModal(True) self.vector_color.clicked.connect( self.vector_color_picker.show) self.vector_color.setValue = self.setButtonColor self.vector_color.value = self.getButtonColor self.chooseStoreDirButton.released.connect( self.chooseStoreDir) self.completer_model.setRootPath('') self.completer.setParent(self.default_gf_dir) self.default_gf_dir.setCompleter(self.completer) self.getAttributes()
Example #28
Source File: base.py From kite with GNU General Public License v3.0 | 5 votes |
def __init__(self, delegate, ui_file, *args, **kwargs): QtWidgets.QDialog.__init__(self, *args, **kwargs) loadUi(get_resource(ui_file), self) self.delegate = delegate self.delegate.sourceParametersChanged.connect( self.getSourceParameters) self.applyButton.released.connect( self.setSourceParameters) self.okButton.released.connect( self.setSourceParameters) self.okButton.released.connect( self.close)
Example #29
Source File: talpa.py From kite with GNU General Public License v3.0 | 5 votes |
def aboutDialog(self): self._about = QtWidgets.QDialog(self) loadUi(get_resource('about.ui'), baseinstance=self._about) return self._about
Example #30
Source File: find.py From Writer-Tutorial with MIT License | 5 votes |
def __init__(self, parent = None): QtWidgets.QDialog.__init__(self, parent) self.parent = parent self.lastStart = 0 self.initUI()