本文整理汇总了Python中PyQt5.QtWidgets.QDialog方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QDialog方法的具体用法?Python QtWidgets.QDialog怎么用?Python QtWidgets.QDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openSimulation
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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
示例2: coilDialog
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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)
示例3: selectFile
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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)
示例4: add_new_phrase_button_clicked
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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()
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:27,代码来源:breathing_phrase_list_wt.py
示例5: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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))
示例6: get_mem
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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
示例7: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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())
示例8: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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()
示例9: eventFilter
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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
示例10: repaint
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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)
示例11: accept
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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)
示例12: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
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)
示例13: onAboutClick
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
def onAboutClick(self):
about = QtWidgets.QDialog()
about.ui = Ui_About()
about.ui.setupUi(about)
about.setAttribute(QtCore.Qt.WA_DeleteOnClose)
about.setWindowTitle("About MultiBootUSB - " + mbusb_version())
about.setWindowIcon(QtGui.QIcon(resource_path(os.path.join("data", "tools", "multibootusb.png"))))
about.ui.button_close.clicked.connect(about.close)
about.ui.label_6.linkActivated.connect(webbrowser.open_new_tab)
about.exec_()
示例14: return_el_struct
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
def return_el_struct(self):
dialog = Ui_Electrode(self.electrode_struct)
result = dialog.exec_()
struct = dialog.electrode_struct
return (struct, result == QtWidgets.QDialog.Accepted)
#####################################################################
############Electrode OpenGL Model###################################
#####################################################################
示例15: fileDialog
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialog [as 别名]
def fileDialog(self):
dialog = QtWidgets.QFileDialog(self)
dialog.setWindowTitle('Open Mesh File')
dialog.setNameFilter('gmsh files (*.msh)')
dialog.setDirectory(QtCore.QDir.currentPath())
dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
filename = None
if dialog.exec_() == QtWidgets.QDialog.Accepted:
filename = dialog.selectedFiles()
if filename:
fn = str(filename[0])
self.file_name.setText(fn)
self.loadHeadModel(fn)
self.lookForTensors(fn)