def initUI(self): self.mainlayout = QHBoxLayout(self) self.mainlayout.setContentsMargins(0, 0, 0, 0) self.container = QWidget(self) self.container.setStyleSheet("background-color:white;") self.setWindowTitle('SequenceIons Viewer') self.seqIons_layout = QHBoxLayout(self.container) # change default setting of 11 px self.seqIons_layout.setContentsMargins(0, 0, 0, 0) self._pep = observed_peptide() # resize window to fit peptide size self.resize() self._pep.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) self._pep.setMinimumSize(SequenceIonsWidget.WIDTH, SequenceIonsWidget.HEIGHT) self.seqIons_layout.addItem( QSpacerItem(40, SequenceIonsWidget.HEIGHT, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.seqIons_layout.addWidget(self._pep) self.seqIons_layout.addItem( QSpacerItem(40, SequenceIonsWidget.HEIGHT, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)) self.setFixedHeight(SequenceIonsWidget.HEIGHT) self.mainlayout.addWidget(self.container) self.show()
def __init__(self, parent=None): super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint) self._migration, vbox, hbox = {}, QVBoxLayout(self), QHBoxLayout() lbl_title = QLabel(translations.TR_CURRENT_CODE) lbl_suggestion = QLabel(translations.TR_SUGGESTED_CHANGES) self.current_list, self.suggestion = QListWidget(), QPlainTextEdit() self.suggestion.setReadOnly(True) self.btn_apply = QPushButton(translations.TR_APPLY_CHANGES + " !") self.suggestion.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !") self.btn_apply.setToolTip(translations.TR_SAVE_BEFORE_APPLY + " !") # pack up all widgets hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(self.btn_apply) vbox.addWidget(lbl_title) vbox.addWidget(self.current_list) vbox.addWidget(lbl_suggestion) vbox.addWidget(self.suggestion) vbox.addLayout(hbox) # connections self.connect(self.current_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.load_suggestion) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes) # registers IDE.register_service('tab_migration', self) ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
def test(self): tab1 = QWidget() scrollArea = QScrollArea(tab1) scrollArea.setMinimumSize(984, 550) scrollArea.setWidgetResizable(True) labelsContainer = QWidget() labelsContainer.setMinimumSize(0, 1500) scrollArea.setWidget(labelsContainer) layout = QVBoxLayout(labelsContainer) time = [ '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00' ] value = [1.2, 2, 1, 4] xdict = dict(enumerate(time)) ticks = [list(zip(range(4), tuple(time)))] vb = CustomViewBox() plt = pg.PlotWidget(title="标题这里填写", viewBox=vb) plt.setBackground(background=None) plt.plot(list(xdict.keys()), value) plt.getPlotItem().getAxis("bottom").setTicks(ticks) temp = QWidget() temp.setMinimumSize(900, 300) temp.setMaximumSize(900, 300) layout1 = QVBoxLayout(temp) layout1.addWidget(plt) layout.addWidget(temp) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) layout.addItem(spacerItem) self.tabWidget.addTab(tab1, '这里tabWidget修改标签')
def __init__(self, parent): super(SchemesManagerWidget, self).__init__(parent, Qt.Dialog) self.setWindowTitle(translations.TR_EDITOR_SCHEMES) self.resize(700, 500) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) # Footer hbox = QHBoxLayout() btn_close = QPushButton(self.tr('Close')) btnReload = QPushButton(self.tr("Reload")) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.show() self._schemes = [] self._loading = True self.downloadItems = [] #Load Themes with Thread self.connect(btnReload, SIGNAL("clicked()"), self._reload_themes) self._thread = ui_tools.ThreadExecution(self.execute_thread) self.connect(self._thread, SIGNAL("finished()"), self.load_skins_data) self.connect(btn_close, SIGNAL('clicked()'), self.close) self._reload_themes()
def __init__(self, suggested, parent=None): super(PythonDetectDialog, self).__init__(parent, Qt.Dialog) self.setMaximumSize(QSize(0, 0)) self.setWindowTitle("Configure Python Path") vbox = QVBoxLayout(self) msg_str = ("We have detected that you are using " "Windows,\nplease choose the proper " "Python application for you:") lblMessage = QLabel(self.tr(msg_str)) vbox.addWidget(lblMessage) self.listPaths = QListWidget() self.listPaths.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.listPaths) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btnCancel = QPushButton(self.tr("Cancel")) btnAccept = QPushButton(self.tr("Accept")) hbox.addWidget(btnCancel) hbox.addWidget(btnAccept) vbox.addLayout(hbox) self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path) self.connect(btnCancel, SIGNAL("clicked()"), self.close) for path in suggested: self.listPaths.addItem(path) self.listPaths.setCurrentRow(0)
def __init__(self, parent): super(ThemeEditor, self).__init__(parent, Qt.Dialog) vbox = QVBoxLayout(self) hbox = QHBoxLayout() self.line_name = QLineEdit() self.btn_save = QPushButton(translations.TR_SAVE) self.line_name.setPlaceholderText(getuser().capitalize() + "s_theme") hbox.addWidget(self.line_name) hbox.addWidget(self.btn_save) self.edit_qss = QPlainTextEdit() css = 'QPlainTextEdit {color: %s; background-color: %s;' \ 'selection-color: %s; selection-background-color: %s;}' \ % (resources.CUSTOM_SCHEME.get( 'editor-text', resources.COLOR_SCHEME['Default']), resources.CUSTOM_SCHEME.get( 'EditorBackground', resources.COLOR_SCHEME['EditorBackground']), resources.CUSTOM_SCHEME.get( 'EditorSelectionColor', resources.COLOR_SCHEME['EditorSelectionColor']), resources.CUSTOM_SCHEME.get( 'EditorSelectionBackground', resources.COLOR_SCHEME['EditorSelectionBackground'])) self.edit_qss.setStyleSheet(css) self.btn_apply = QPushButton(self.tr("Apply Style Sheet")) hbox2 = QHBoxLayout() hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(self.btn_apply) hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) vbox.addWidget(self.edit_qss) vbox.addLayout(hbox) vbox.addLayout(hbox2) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_stylesheet) self.connect(self.btn_save, SIGNAL("clicked()"), self.save_stylesheet)
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtName.setPlaceholderText('my_plugin') self._txtVersion = QLineEdit() self._txtVersion.setPlaceholderText('0.1') form.addRow(translations.TR_PROJECT_NAME, self._txtName) form.addRow(translations.TR_VERSION, self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._txtFilePath.setPlaceholderText( os.path.join(os.path.expanduser('~'), 'full', 'path', 'to', 'plugin.zip')) self._btnFilePath = QPushButton(QIcon(":img/open"), '') self.completer, self.dirs = QCompleter(self), QDirModel(self) self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot) self.completer.setModel(self.dirs) self._txtFilePath.setCompleter(self.completer) hPath.addWidget(QLabel(translations.TR_FILENAME)) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem( QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(translations.TR_INSTALL) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(translations.TR_PLUGIN_MANAGER) self.resize(700, 600) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) self._txt_data = QTextBrowser() self._txt_data.setOpenLinks(False) vbox.addWidget(QLabel(translations.TR_PROJECT_DESCRIPTION)) vbox.addWidget(self._txt_data) # Footer hbox = QHBoxLayout() btn_close = QPushButton(translations.TR_CLOSE) btnReload = QPushButton(translations.TR_RELOAD) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.hide() self._oficial_available = [] self._community_available = [] self._locals = [] self._updates = [] self._loading = True self._requirements = {} self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins) self.thread = ThreadLoadPlugins(self) self.connect(self.thread, SIGNAL("finished()"), self._load_plugins_data) self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"), self._after_download_plugin) self.connect(self.thread, SIGNAL("plugin_manually_installed(PyQt_PyObject)"), self._after_manual_install_plugin) self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"), self._after_uninstall_plugin) self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"), self._open_link) self.connect(btn_close, SIGNAL('clicked()'), self.close) self.overlay.show() self._reload_plugins()
def test(self): tab1 = QWidget() scrollArea = QScrollArea(tab1) scrollArea.setMinimumSize(650, 550) scrollArea.setWidgetResizable(True) labelsContainer = QWidget() labelsContainer.setMinimumSize(0, 3000 + 200) scrollArea.setWidget(labelsContainer) layout = QVBoxLayout(labelsContainer) time = [ '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00', '2019-04-20 08:09:00' ] value = [1.2, 2, 1, 4] xdict = dict(enumerate(time)) ticks = [list(zip(range(4), tuple(time)))] for i in range(11): vb1 = CustomViewBox() plt1 = pg.PlotWidget(title="Basic array plotting%s" % i, viewBox=vb1) plt1.resize(500, 500) plt1.setBackground(background=None) plt1.plot(list(xdict.keys()), value) plt1.getPlotItem().getAxis("bottom").setTicks(ticks) temp1 = QWidget() temp1.setMinimumSize(600, 300) temp1.setMaximumSize(600, 300) layout2 = QVBoxLayout(temp1) layout2.addWidget(plt1) layout.addWidget(temp1) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) layout.addItem(spacerItem) # print(layout.count()) self.tabWidget.addTab(tab1, '12') for i in range(self.tabWidget.count()): self.tabWidget.widget(i)
def __init__(self, parent): super(Theme, self).__init__() self._preferences, vbox = parent, QVBoxLayout(self) vbox.addWidget(QLabel(self.tr("<b>Select Theme:</b>"))) self.list_skins = QListWidget() self.list_skins.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.list_skins) self.btn_delete = QPushButton(self.tr("Delete Theme")) self.btn_preview = QPushButton(self.tr("Preview Theme")) self.btn_create = QPushButton(self.tr("Create Theme")) hbox = QHBoxLayout() hbox.addWidget(self.btn_delete) hbox.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox.addWidget(self.btn_preview) hbox.addWidget(self.btn_create) vbox.addLayout(hbox) self._refresh_list() self.connect(self.btn_preview, SIGNAL("clicked()"), self.preview_theme) self.connect(self.btn_delete, SIGNAL("clicked()"), self.delete_theme) self.connect(self.btn_create, SIGNAL("clicked()"), self.create_theme) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def __init__(self, parent): super(EditorCompletion, self).__init__() self._preferences = parent vbox = QVBoxLayout(self) groupBoxClose = QGroupBox(translations.TR_PREF_EDITOR_COMPLETE) formClose = QGridLayout(groupBoxClose) formClose.setContentsMargins(5, 15, 5, 5) self._checkParentheses = QCheckBox( translations.TR_PREF_EDITOR_PARENTHESES + " ()") self._checkParentheses.setChecked('(' in settings.BRACES) self._checkKeys = QCheckBox(translations.TR_PREF_EDITOR_KEYS + " {}") self._checkKeys.setChecked('{' in settings.BRACES) self._checkBrackets = QCheckBox(translations.TR_PREF_EDITOR_BRACKETS + " []") self._checkBrackets.setChecked('[' in settings.BRACES) self._checkSimpleQuotes = QCheckBox( translations.TR_PREF_EDITOR_SIMPLE_QUOTES) self._checkSimpleQuotes.setChecked("'" in settings.QUOTES) self._checkDoubleQuotes = QCheckBox( translations.TR_PREF_EDITOR_DOUBLE_QUOTES) self._checkDoubleQuotes.setChecked('"' in settings.QUOTES) self._checkCompleteDeclarations = QCheckBox( translations.TR_PREF_EDITOR_COMPLETE_DECLARATIONS.format( resources.get_shortcut("Complete-Declarations").toString( QKeySequence.NativeText))) self._checkCompleteDeclarations.setChecked( settings.COMPLETE_DECLARATIONS) formClose.addWidget(self._checkParentheses, 1, 1, alignment=Qt.AlignTop) formClose.addWidget(self._checkKeys, 1, 2, alignment=Qt.AlignTop) formClose.addWidget(self._checkBrackets, 2, 1, alignment=Qt.AlignTop) formClose.addWidget(self._checkSimpleQuotes, 2, 2, alignment=Qt.AlignTop) formClose.addWidget(self._checkDoubleQuotes, 3, 1, alignment=Qt.AlignTop) vbox.addWidget(groupBoxClose) groupBoxCode = QGroupBox(translations.TR_PREF_EDITOR_CODE_COMPLETION) formCode = QGridLayout(groupBoxCode) formCode.setContentsMargins(5, 15, 5, 5) self._checkCodeDot = QCheckBox( translations.TR_PREF_EDITOR_ACTIVATE_COMPLETION) self._checkCodeDot.setChecked(settings.CODE_COMPLETION) formCode.addWidget(self._checkCompleteDeclarations, 5, 1, alignment=Qt.AlignTop) formCode.addWidget(self._checkCodeDot, 6, 1, alignment=Qt.AlignTop) vbox.addWidget(groupBoxCode) vbox.addItem( QSpacerItem(0, 10, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)