本文整理汇总了Python中qtpy.QtWidgets.QDialog类的典型用法代码示例。如果您正苦于以下问题:Python QDialog类的具体用法?Python QDialog怎么用?Python QDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: resizeEvent
def resizeEvent(self, event):
"""
Reimplement Qt method to be able to save the widget's size from the
main application
"""
QDialog.resizeEvent(self, event)
self.size_change.emit(self.size())
开发者ID:burrbull,项目名称:spyder,代码行数:7,代码来源:runconfig.py
示例2: __init__
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setWindowTitle("Spyder %s: %s" % (__version__,
_("Dependencies")))
self.setWindowIcon(ima.icon('tooloptions'))
self.setModal(True)
self.treewidget = DependenciesTreeWidget(self)
self.label = QLabel(_("Optional modules are not required to run "
"Spyder but enhance its functions."))
self.label2 = QLabel(_("<b>Note:</b> New dependencies or changed ones "
"will be correctly detected only after Spyder "
"is restarted."))
btn = QPushButton(_("Copy to clipboard"), )
btn.clicked.connect(self.copy_to_clipboard)
bbox = QDialogButtonBox(QDialogButtonBox.Ok)
bbox.accepted.connect(self.accept)
hlayout = QHBoxLayout()
hlayout.addWidget(btn)
hlayout.addStretch()
hlayout.addWidget(bbox)
vlayout = QVBoxLayout()
vlayout.addWidget(self.treewidget)
vlayout.addWidget(self.label)
vlayout.addWidget(self.label2)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.resize(840, 560)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:32,代码来源:dependencies.py
示例3: __init__
def __init__(self, parent, plugin, tabs, data, icon):
QDialog.__init__(self, parent)
# Variables
self.plugins_tabs = []
self.plugins_data = []
self.plugins_instances = []
self.add_plugin(plugin, tabs, data, icon)
self.plugin = None # Last plugin with focus
self.mode = self.FILE_MODE # By default start in this mode
self.initial_cursors = None # {fullpath: QCursor}
self.initial_path = None # Fullpath of initial active editor
self.initial_widget = None # Initial active editor
self.line_number = None # Selected line number in filer
self.is_visible = False # Is the switcher visible?
help_text = _("Press <b>Enter</b> to switch files or <b>Esc</b> to "
"cancel.<br><br>Type to filter filenames.<br><br>"
"Use <b>:number</b> to go to a line, e.g. "
"<b><code>main:42</code></b><br>"
"Use <b>@symbol_text</b> to go to a symbol, e.g. "
"<b><code>@init</code></b>"
"<br><br> Press <b>Ctrl+W</b> to close current tab.<br>")
# Either allow searching for a line number or a symbol but not both
regex = QRegExp("([A-Za-z0-9_]{0,100}@[A-Za-z0-9_]{0,100})|" +
"([A-Za-z0-9_]{0,100}:{0,1}[0-9]{0,100})")
# Widgets
self.edit = FilesFilterLine(self)
self.help = HelperToolButton()
self.list = QListWidget(self)
self.filter = KeyPressFilter()
regex_validator = QRegExpValidator(regex, self.edit)
# Widgets setup
self.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
self.setWindowOpacity(0.95)
self.edit.installEventFilter(self.filter)
self.edit.setValidator(regex_validator)
self.help.setToolTip(help_text)
self.list.setItemDelegate(HTMLDelegate(self))
# Layout
edit_layout = QHBoxLayout()
edit_layout.addWidget(self.edit)
edit_layout.addWidget(self.help)
layout = QVBoxLayout()
layout.addLayout(edit_layout)
layout.addWidget(self.list)
self.setLayout(layout)
# Signals
self.rejected.connect(self.restore_initial_state)
self.filter.sig_up_key_pressed.connect(self.previous_row)
self.filter.sig_down_key_pressed.connect(self.next_row)
self.edit.returnPressed.connect(self.accept)
self.edit.textChanged.connect(self.setup)
self.list.itemSelectionChanged.connect(self.item_selection_changed)
self.list.clicked.connect(self.edit.setFocus)
开发者ID:rlaverde,项目名称:spyder,代码行数:60,代码来源:fileswitcher.py
示例4: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.main = parent
# Widgets
self.pages_widget = QStackedWidget()
self.pages_widget.setMinimumWidth(600)
self.contents_widget = QListWidget()
self.button_reset = QPushButton(_('Reset to defaults'))
bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
QDialogButtonBox.Cancel)
self.apply_btn = bbox.button(QDialogButtonBox.Apply)
# Widgets setup
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
self.setWindowTitle(_('Preferences'))
self.setWindowIcon(ima.icon('configure'))
self.contents_widget.setMovement(QListView.Static)
self.contents_widget.setSpacing(1)
self.contents_widget.setCurrentRow(0)
self.contents_widget.setMinimumWidth(220)
self.contents_widget.setMinimumHeight(400)
# Layout
hsplitter = QSplitter()
hsplitter.addWidget(self.contents_widget)
hsplitter.addWidget(self.pages_widget)
hsplitter.setStretchFactor(0, 1)
hsplitter.setStretchFactor(1, 2)
btnlayout = QHBoxLayout()
btnlayout.addWidget(self.button_reset)
btnlayout.addStretch(1)
btnlayout.addWidget(bbox)
vlayout = QVBoxLayout()
vlayout.addWidget(hsplitter)
vlayout.addLayout(btnlayout)
self.setLayout(vlayout)
# Signals and slots
if self.main:
self.button_reset.clicked.connect(self.main.reset_spyder)
self.pages_widget.currentChanged.connect(self.current_page_changed)
self.contents_widget.currentRowChanged.connect(
self.pages_widget.setCurrentIndex)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
bbox.clicked.connect(self.button_clicked)
# Ensures that the config is present on spyder first run
CONF.set('main', 'interface_language', load_lang_conf())
开发者ID:impact27,项目名称:spyder,代码行数:59,代码来源:configdialog.py
示例5: accept
def accept(self):
"""Reimplement Qt method"""
if not self.runconfigoptions.is_valid():
return
configurations = _get_run_configurations()
configurations.insert(0, (self.filename, self.runconfigoptions.get()))
_set_run_configurations(configurations)
QDialog.accept(self)
开发者ID:burrbull,项目名称:spyder,代码行数:8,代码来源:runconfig.py
示例6: accept
def accept(self):
"""Reimplement Qt method"""
for index in range(self.pages_widget.count()):
configpage = self.get_page(index)
if not configpage.is_valid():
return
configpage.apply_changes()
QDialog.accept(self)
开发者ID:impact27,项目名称:spyder,代码行数:8,代码来源:configdialog.py
示例7: __init__
def __init__(self, text, title='', font=None, parent=None,
readonly=False, size=(400, 300)):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
self.text = None
self.btn_save_and_close = None
# Display text as unicode if it comes as bytes, so users see
# its right representation
if is_binary_string(text):
self.is_binary = True
text = to_text_string(text, 'utf8')
else:
self.is_binary = False
self.layout = QVBoxLayout()
self.setLayout(self.layout)
# Text edit
self.edit = QTextEdit(parent)
self.edit.setReadOnly(readonly)
self.edit.textChanged.connect(self.text_changed)
self.edit.setPlainText(text)
if font is None:
font = get_font()
self.edit.setFont(font)
self.layout.addWidget(self.edit)
# Buttons configuration
btn_layout = QHBoxLayout()
btn_layout.addStretch()
if not readonly:
self.btn_save_and_close = QPushButton(_('Save and Close'))
self.btn_save_and_close.setDisabled(True)
self.btn_save_and_close.clicked.connect(self.accept)
btn_layout.addWidget(self.btn_save_and_close)
self.btn_close = QPushButton(_('Close'))
self.btn_close.setAutoDefault(True)
self.btn_close.setDefault(True)
self.btn_close.clicked.connect(self.reject)
btn_layout.addWidget(self.btn_close)
self.layout.addLayout(btn_layout)
# Make the dialog act as a window
self.setWindowFlags(Qt.Window)
self.setWindowIcon(ima.icon('edit'))
self.setWindowTitle(_("Text editor") + \
"%s" % (" - "+str(title) if str(title) else ""))
self.resize(size[0], size[1])
开发者ID:burrbull,项目名称:spyder,代码行数:58,代码来源:texteditor.py
示例8: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
self.is_series = False
self.layout = None
开发者ID:rlaverde,项目名称:spyder,代码行数:9,代码来源:dataframeeditor.py
示例9: accept
def accept(self):
"""Reimplement Qt method"""
configurations = []
for index in range(self.stack.count()):
filename = to_text_string(self.combo.itemText(index))
runconfigoptions = self.stack.widget(index)
if index == self.stack.currentIndex() and not runconfigoptions.is_valid():
return
options = runconfigoptions.get()
configurations.append((filename, options))
_set_run_configurations(configurations)
QDialog.accept(self)
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:12,代码来源:runconfig.py
示例10: __init__
def __init__(self, parent=None):
self.parent = parent
QDialog.__init__(self, parent=parent)
self.ui = load_ui('filter_rule_editor.ui', baseinstance=self)
#self.ui = UiDialog()
#self.ui.setupUi(self)
self.init_widgets()
self.load_global_rule_dict()
self.refresh_global_rule()
self.check_widgets()
开发者ID:neutrons,项目名称:FastGR,代码行数:12,代码来源:global_rule_handler.py
示例11: __init__
def __init__(self, instrument_list=None):
QDialog.__init__(self)
self.ui = load_ui(__file__, 'ui/instrument_dialog.ui', baseinstance=self)
self.instrument_list = instrument_list
self.instr_combo.clear()
self.facility_combo.clear()
instruments = sorted(INSTRUMENT_DICT.keys())
instruments.reverse()
for facility in instruments:
self.facility_combo.addItem(facility)
self._facility_changed(instruments[0])
self.facility_combo.activated.connect(self._facility_changed)
开发者ID:samueljackson92,项目名称:mantid,代码行数:13,代码来源:reduction_application.py
示例12: __init__
def __init__(self, parent=None, pathlist=None, ro_pathlist=None,
not_active_pathlist=None, sync=True):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
assert isinstance(pathlist, list)
self.pathlist = pathlist
if not_active_pathlist is None:
not_active_pathlist = []
self.not_active_pathlist = not_active_pathlist
if ro_pathlist is None:
ro_pathlist = []
self.ro_pathlist = ro_pathlist
self.last_path = getcwd()
self.setWindowTitle(_("PYTHONPATH manager"))
self.setWindowIcon(ima.icon('pythonpath'))
self.resize(500, 300)
self.selection_widgets = []
layout = QVBoxLayout()
self.setLayout(layout)
top_layout = QHBoxLayout()
layout.addLayout(top_layout)
self.toolbar_widgets1 = self.setup_top_toolbar(top_layout)
self.listwidget = QListWidget(self)
self.listwidget.currentRowChanged.connect(self.refresh)
self.listwidget.itemChanged.connect(self.update_not_active_pathlist)
layout.addWidget(self.listwidget)
bottom_layout = QHBoxLayout()
layout.addLayout(bottom_layout)
self.sync_button = None
self.toolbar_widgets2 = self.setup_bottom_toolbar(bottom_layout, sync)
# Buttons configuration
bbox = QDialogButtonBox(QDialogButtonBox.Close)
bbox.rejected.connect(self.reject)
bottom_layout.addWidget(bbox)
self.update_list()
self.refresh()
开发者ID:rlaverde,项目名称:spyder,代码行数:51,代码来源:pathmanager.py
示例13: __init__
def __init__(self, parent=None, father=None):
self.parent = parent
self.father = father
QDialog.__init__(self, parent=parent)
self.ui = load_ui('launchMantid.ui', baseinstance=self)
_title = "Launching Mantid Reduction"
self.setWindowTitle(_title)
_runs = self.father.parameters['runs']
nbr_jobs = len(_runs)
_message = 'You are about to launch {} Mantid Reductions jobs!'.format(nbr_jobs)
self.ui.label.setText(_message)
开发者ID:neutrons,项目名称:FastGR,代码行数:14,代码来源:mantid_reduction_dialogbox.py
示例14: reject
def reject(self):
""" """
if self.busy:
answer = QMessageBox.question(
self,
'Quit Conda Manager?',
'Conda is still busy.\n\nDo you want to quit?',
buttons=QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
QDialog.reject(self)
# Do some cleanup?
else:
QDialog.reject(self)
开发者ID:Discalced51,项目名称:conda-manager,代码行数:14,代码来源:packages.py
示例15: keyPressEvent
def keyPressEvent(self, event):
"""
Qt override.
"""
QToolTip.hideText()
ctrl = event.modifiers() & Qt.ControlModifier
if event.key() in [Qt.Key_Enter, Qt.Key_Return]:
if ctrl:
self.process_text(array=False)
else:
self.process_text(array=True)
self.accept()
else:
QDialog.keyPressEvent(self, event)
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:15,代码来源:arraybuilder.py
示例16: showText
def showText(self):
"""
Creates a dialog to show the generated text output.
"""
try:
generatedText = self.genText()
except ValueError:
return
self.txtwin = QDialog()
self.txtedt = QTextEdit()
self.txtbtn = QPushButton('OK')
self.txtwin.layout = QVBoxLayout(self.txtwin)
self.txtwin.layout.addWidget(self.txtedt)
self.txtwin.layout.addWidget(self.txtbtn)
self.txtbtn.clicked.connect(self.txtwin.deleteLater)
self.txtedt.setText(generatedText)
self.txtedt.setReadOnly(True)
self.txtwin.setWindowTitle('Resolution information')
self.txtwin.setWindowModality(Qt.ApplicationModal)
self.txtwin.setAttribute(Qt.WA_DeleteOnClose)
self.txtwin.setMinimumSize(400, 600)
self.txtwin.resize(400, 600)
self.txtwin.show()
self.txtloop = QEventLoop()
self.txtloop.exec_()
开发者ID:mantidproject,项目名称:mantid,代码行数:25,代码来源:PyChopGui.py
示例17: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
# Destroying the C++ object right after closing the dialog box,
# otherwise it may be garbage-collected in another QThread
# (e.g. the editor's analysis thread in Spyder), thus leading to
# a segmentation fault on UNIX or an application crash on Windows
self.setAttribute(Qt.WA_DeleteOnClose)
self.data = None
self.arraywidget = None
self.stack = None
self.layout = None
# Values for 3d array editor
self.dim_indexes = [{}, {}, {}]
self.last_dim = 0 # Adjust this for changing the startup dimension
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:16,代码来源:arrayeditor.py
示例18: __init__
def __init__(self, ui_module, parent, modal=True, connect_actions=True):
self.gui = parent
QtGuiApplication.__init__(self, ui_module)
QDialog.__init__(self, parent)
self.modal = modal
self.setModal(modal)
try:
self.ui = ui_module.Ui_Form()
self.setupUI(self)
except:
self.compile_ui(ui_module, True)
self.ui = ui_module.Ui_Form()
self.setupUI(self)
if connect_actions:
self.connect_actions()
开发者ID:madsmpedersen,项目名称:MMPE,代码行数:16,代码来源:QtGuiLoader.py
示例19: onHelp
def onHelp(self):
"""
Shows the help page
"""
try:
from pymantidplot.proxies import showCustomInterfaceHelp
showCustomInterfaceHelp("PyChop")
except ImportError:
helpTxt = "PyChop is a tool to allow direct inelastic neutron\nscattering users to estimate the inelastic resolution\n"
helpTxt += "and incident flux for a given spectrometer setting.\n\nFirst select the instrument, chopper settings and\n"
helpTxt += "Ei, and then click 'Calculate and Plot'. Data for all\nthe graphs will be generated (may take 1-2s) and\n"
helpTxt += "all graphs will be updated. If the 'Hold current plot'\ncheck box is ticked, additional settings will be\n"
helpTxt += "overplotted on the existing graphs if they are\ndifferent from previous settings.\n\nMore in-depth help "
helpTxt += "can be obtained from the\nMantid help pages."
self.hlpwin = QDialog()
self.hlpedt = QLabel(helpTxt)
self.hlpbtn = QPushButton('OK')
self.hlpwin.layout = QVBoxLayout(self.hlpwin)
self.hlpwin.layout.addWidget(self.hlpedt)
self.hlpwin.layout.addWidget(self.hlpbtn)
self.hlpbtn.clicked.connect(self.hlpwin.deleteLater)
self.hlpwin.setWindowTitle('Help')
self.hlpwin.setWindowModality(Qt.ApplicationModal)
self.hlpwin.setAttribute(Qt.WA_DeleteOnClose)
self.hlpwin.setMinimumSize(370, 300)
self.hlpwin.resize(370, 300)
self.hlpwin.show()
self.hlploop = QEventLoop()
self.hlploop.exec_()
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:PyChopGui.py
示例20: cancel_process
def cancel_process(self):
"""
Allow user to cancel an ongoing process.
"""
logger.debug(str('process canceled by user.'))
if self.busy:
dlg = self.cancel_dialog()
reply = dlg.exec_()
if reply:
self.update_status(hide=False, message='Process cancelled')
self.api.conda_terminate()
self.api.download_requests_terminate()
self.api.conda_clear_lock()
self.table.clear_actions()
self.sig_process_cancelled.emit()
else:
QDialog.reject(self)
开发者ID:Discalced51,项目名称:conda-manager,代码行数:17,代码来源:packages.py
注:本文中的qtpy.QtWidgets.QDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论