本文整理汇总了Python中qtpy.QtWidgets.QDialog.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QDialog.__init__方法的具体用法?Python QDialog.__init__怎么用?Python QDialog.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QDialog
的用法示例。
在下文中一共展示了QDialog.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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)
示例3: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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())
示例4: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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])
示例5: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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
示例6: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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()
示例7: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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)
示例8: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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()
示例9: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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)
示例10: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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
示例11: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
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()
示例12: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
def __init__(self, parent=None, key=None, data_type='sample'):
self.parent = parent
self.key = key
self.data_type = data_type
QDialog.__init__(self, parent=parent)
self.ui = load_ui('dimensions_setter.ui', baseinstance=self)
self.group_widgets()
self.init_widgets_layout()
self.init_widgets_content()
if parent.geometry_ui_position:
self.move(parent.geometry_ui_position)
self.check_save_button()
self.set_column_index()
示例13: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setWindowTitle("Spyder %s: %s" % (__version__,
_("Dependencies")))
self.setWindowIcon(ima.icon('tooloptions'))
self.setModal(True)
self.view = DependenciesTableView(self, [])
opt_mods = ['NumPy', 'Matplotlib', 'Pandas', 'SymPy']
self.label = QLabel(_("Spyder depends on several Python modules to "
"provide the right functionality for all its "
"panes. The table below shows the required "
"and installed versions (if any) of all of "
"them.<br><br>"
"<b>Note</b>: You can safely use Spyder "
"without the following modules installed: "
"<b>%s</b> and <b>%s</b>.<br><br>"
"Please also note that new "
"dependencies or changed ones will be correctly "
"detected only after Spyder is restarted.")
% (', '.join(opt_mods[:-1]), opt_mods[-1]))
self.label.setWordWrap(True)
self.label.setAlignment(Qt.AlignJustify)
self.label.setContentsMargins(5, 8, 12, 10)
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.label)
vlayout.addWidget(self.view)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.resize(630, 420)
示例14: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle('Periodic table')
# Variables
self._required_selection = True
# Widgets
self._wdg_table = PeriodicTableWidget()
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# Layouts
layout = QVBoxLayout()
layout.addWidget(self._wdg_table)
layout.addWidget(buttons)
self.setLayout(layout)
# Signals
self._wdg_table.selectionChanged.connect(self.selectionChanged)
buttons.accepted.connect(self._onOk)
buttons.rejected.connect(self._onCancel)
示例15: __init__
# 需要导入模块: from qtpy.QtWidgets import QDialog [as 别名]
# 或者: from qtpy.QtWidgets.QDialog import __init__ [as 别名]
def __init__(self, data, title="", comment="",
icon=None, parent=None, apply=None):
QDialog.__init__(self, parent)
self.apply_callback = apply
# Form
if isinstance(data[0][0], (list, tuple)):
self.formwidget = FormTabWidget(data, comment=comment,
parent=self)
elif len(data[0])==3:
self.formwidget = FormComboWidget(data, comment=comment,
parent=self)
else:
self.formwidget = FormWidget(data, comment=comment,
parent=self)
layout = QVBoxLayout()
layout.addWidget(self.formwidget)
self.float_fields = []
self.formwidget.setup()
# Button box
self.bbox = bbox = QDialogButtonBox(QDialogButtonBox.Ok
|QDialogButtonBox.Cancel)
self.formwidget.update_buttons.connect(self.update_buttons)
if self.apply_callback is not None:
apply_btn = bbox.addButton(QDialogButtonBox.Apply)
apply_btn.clicked.connect(self.apply)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
layout.addWidget(bbox)
self.setLayout(layout)
self.setWindowTitle(title)
if not isinstance(icon, QIcon):
icon = QWidget().style().standardIcon(QStyle.SP_MessageBoxQuestion)
self.setWindowIcon(icon)