def _init_teacher_history_ui(self, function_code): self._teacher_history_ui = QHBoxLayout() self._function_line_edit = QLineEdit(function_code) self._function_line_edit.setFixedWidth(120) self._function_line_edit.textChanged[str].connect(self.__on_change_function) self._learning_rate_line_edit = QLineEdit(str(self._learning_rate)) self._learning_rate_line_edit.setFixedWidth(120) self._learning_rate_line_edit.textChanged[str].connect(self.__on_change_learning_rate) vbox = QVBoxLayout() vbox.addWidget(self._function_line_edit, alignment=Qt.AlignTop) vbox.addWidget(self._learning_rate_line_edit, alignment=Qt.AlignTop) self._slider = QSlider(Qt.Horizontal) self._slider.setMinimum(0) self._slider.setMaximum(0) self._slider.setValue(0) self._slider.setTickPosition(QSlider.NoTicks) self._slider.setTickInterval(1) self._slider.valueChanged[int].connect(self.__on_change_model) self._reset_button = QPushButton("Reset") self._reset_button.clicked.connect(self._reset_model_weights) self._teacher_history_ui.addLayout(vbox) self._teacher_history_ui.addWidget(self._slider, alignment=Qt.Alignment()) self._teacher_history_ui.addWidget(self._reset_button, alignment=Qt.Alignment()) return self._teacher_history_ui
def _init_teacher_controller_ui(self, gradient): self._teacher_controller_ui = QHBoxLayout() self._start_button = QPushButton("Start") self._start_button.clicked.connect(self.start) self._stop_button = QPushButton("Stop") self._stop_button.clicked.connect(self._model_teaching_service.stop) self._iterations = 1000 self._iterations_line_edit = QLineEdit(str(self._iterations)) self._iterations_line_edit.setFixedWidth(120) self._iterations_line_edit.textChanged[str].connect(self._on_change_iterations) self._gradient_strategy_combo_box = QComboBox() self._gradient_strategy_combo_box.addItem("Gradient") self._gradient_strategy_combo_box.addItem("Approximate gradient") self._gradient_strategy_combo_box.setCurrentIndex( self.__get_current_gradient_strategy_index(gradient) ) self._gradient_strategy_combo_box.currentIndexChanged.connect(self.__change_gradient_strategy_index) vbox = QVBoxLayout() vbox.addWidget(self._iterations_line_edit, alignment=Qt.Alignment()) vbox.addWidget(self._gradient_strategy_combo_box, alignment=Qt.Alignment()) self._teacher_controller_ui.addLayout(vbox) self._teacher_controller_ui.addWidget(self._start_button, alignment=Qt.Alignment()) self._teacher_controller_ui.addWidget(self._stop_button, alignment=Qt.Alignment()) return self._teacher_controller_ui
def group1(self): """ Label widgets at row 0, col 0. """ vbox = QVBoxLayout() label_soft = QLabel('Software') label_path = QLabel('Path') label_pipeline = QLabel('Run pipeline in') label_picker = QLabel('Particle picker') label_model = QLabel('Trained model for picking') label_mode = QLabel('Data processing type') self.label_diam = QLabel('Particle size (A)') self.label_sym = QLabel('Symmetry') self.label_filament_width = QLabel('Filament width (A)') self.label_filament_width.setVisible(False) vbox.addWidget(label_soft, alignment=Qt.Alignment()) vbox.addWidget(label_path, alignment=Qt.Alignment()) vbox.addWidget(label_pipeline, alignment=Qt.Alignment()) vbox.addWidget(label_picker, alignment=Qt.Alignment()) vbox.addWidget(label_model, alignment=Qt.Alignment()) vbox.addWidget(label_mode, alignment=Qt.Alignment()) vbox.addWidget(self.label_diam, alignment=Qt.Alignment()) vbox.addWidget(self.label_sym, alignment=Qt.Alignment()) vbox.addWidget(self.label_filament_width, alignment=Qt.Alignment()) return vbox
def __init__(self, parent=None): super(ui_DIYPanel, self).__init__(parent, flags=Qt.WindowFlags()) self.verticalLayout = QtWidgets.QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.TabAreaScroll = uni_Widget.ICTFEScrollArea(self) size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) size_policy.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth( self.TabAreaScroll.sizePolicy().hasHeightForWidth()) self.TabAreaScroll.setSizePolicy(size_policy) self.TabAreaScroll.setMinimumSize(QtCore.QSize(1200, 130)) self.TabAreaScroll.setWidgetResizable(True) self.TabAreaScroll.setObjectName("TabAreaScroll") self.TabAreaPanel = ResizablePanel() self.TabAreaPanel.setGeometry(QtCore.QRect(0, 0, 1600, 128)) self.TabAreaPanel.setObjectName("TabAreaPanel") self.TabAreaPanel.TheAddButton.clicked.connect(self.AddTabPanel) self.TabAreaPanel.setStyleSheet('background-color: transparent') self.TabAreaScroll.setWidget(self.TabAreaPanel) self.verticalLayout.addWidget(self.TabAreaScroll, alignment=Qt.Alignment()) self.SplitterWidget = QtWidgets.QWidget(self, flags=Qt.WindowFlags()) self.SplitterWidget.setMaximumHeight(1) self.SplitterWidget.setMinimumHeight(1) self.SplitterWidget.setStyleSheet("QWidget{" "background-color: grey;" "border: 1px grey;" "border-style: solid;" "}") self.verticalLayout.addWidget(self.SplitterWidget, alignment=Qt.Alignment()) # 下层 self.TabStack = QtWidgets.QStackedWidget(self) self.TabStack.setObjectName("TabStack") self.verticalLayout.addWidget(self.TabStack, alignment=Qt.Alignment()) # 统一管理 self.TabButtons = self.TabAreaPanel.Buttons # 通过List进行有序化管理 self.TabPanels = [] self.FileButtons = [] self.ReadDataBase()
def _init_ui(self): self._chart_widget = NeuralNetworkChartWidget(self._function_code) self._model_teaching_controller_widget = NeuralNetworkTeachingControllerWidget( self._function_code, self._model, self._teacher, self._gradient, self._error, self._train_data_store, self._learning_rate, parent=self) self._model_teaching_controller_widget.on_change_model = self._on_update_model self._model_teaching_controller_widget.on_start_teaching = self.__on_start_teaching self._model_teaching_controller_widget.on_stop_teaching = self.__on_stop_teaching self._model_teaching_controller_widget.on_change_function = self.__on_change_function self._neural_network_model_controller_widget = NeuralNetworkModelControllerWidget( self._model) self._neural_network_layout = QVBoxLayout() self._neural_network_layout.addWidget(self._chart_widget, alignment=Qt.Alignment()) self._neural_network_layout.addWidget( self._model_teaching_controller_widget, alignment=Qt.AlignBottom) self._neural_network_row_layout = QHBoxLayout(self) self._neural_network_row_layout.addWidget( self._neural_network_model_controller_widget, alignment=Qt.AlignLeft) self._neural_network_row_layout.addLayout(self._neural_network_layout) self._update_all_charts()
def updateUI(self): theme = self.m_themeComboBox.itemData( self.m_themeComboBox.currentIndex()) if self.m_charts[0].chart().theme() != theme: for chartView in self.m_charts: chartView.chart().setTheme(theme) pal = self.window().palette() if theme == QChart.ChartThemeLight: pal.setColor(QPalette.Window, QColor(0xf0f0f0)) pal.setColor(QPalette.WindowText, QColor(0x404044)) elif theme == QChart.ChartThemeDark: pal.setColor(QPalette.Window, QColor(0x121218)) pal.setColor(QPalette.WindowText, QColor(0xd6d6d6)) elif theme == QChart.ChartThemeBlueCerulean: pal.setColor(QPalette.Window, QColor(0x40434a)) pal.setColor(QPalette.WindowText, QColor(0xd6d6d6)) elif theme == QChart.ChartThemeBrownSand: pal.setColor(QPalette.Window, QColor(0x9e8965)) pal.setColor(QPalette.WindowText, QColor(0x404044)) elif theme == QChart.ChartThemeBlueNcs: pal.setColor(QPalette.Window, QColor(0x018bba)) pal.setColor(QPalette.WindowText, QColor(0x404044)) elif theme == QChart.ChartThemeHighContrast: pal.setColor(QPalette.Window, QColor(0xffab03)) pal.setColor(QPalette.WindowText, QColor(0x181818)) elif theme == QChart.ChartThemeBlueIcy: pal.setColor(QPalette.Window, QColor(0xcee7f0)) pal.setColor(QPalette.WindowText, QColor(0x404044)) else: pal.setColor(QPalette.Window, QColor(0xf0f0f0)) pal.setColor(QPalette.WindowText, QColor(0x404044)) self.window().setPalette(pal) checked = self.m_antialiasCheckBox.isChecked() for chartView in self.m_charts: chartView.setRenderHint(QPainter.Antialiasing, checked) options = QChart.AnimationOptions( self.m_animatedComboBox.itemData( self.m_animatedComboBox.currentIndex())) if self.m_charts[0].chart().animationOptions() != options: for chartView in self.m_charts: chartView.chart().setAnimationOptions(options) alignment = self.m_legendComboBox.itemData( self.m_legendComboBox.currentIndex()) for chartView in self.m_charts: legend = chartView.chart().legend() if alignment == 0: legend.hide() else: legend.setAlignment(Qt.Alignment(alignment)) legend.show()
def __init__(self, parent=None): super(WebBrowserPanelWidget, self).__init__(parent, flags=Qt.WindowFlags()) self.browser = QtWebEngineWidgets.QWebEngineView(self) pwd = os.getcwd() pwd = pwd.replace('\\', '/') self.browser.load(QtCore.QUrl('https://postwoman.io/')) self.Layouts = QtWidgets.QHBoxLayout(self) self.Layouts.addWidget(self.browser, alignment=Qt.Alignment()) self.Layouts.setSpacing(0) self.Layouts.setContentsMargins(0, 0, 0, 0) self.browser.urlChanged.connect(lambda link: self.SuitLocalWeb(link)) self.browser.show() self.browser.setZoomFactor(1) self.setLayout(self.Layouts) osinfo = platform.system() if osinfo == 'Windows': self.browser.settings().setFontFamily( QWebEngineSettings.StandardFont, '微软雅黑') self.browser.settings().setFontFamily(QWebEngineSettings.FixedFont, '微软雅黑') self.browser.settings().setFontFamily(QWebEngineSettings.SerifFont, '微软雅黑') self.browser.settings().setFontFamily( QWebEngineSettings.SansSerifFont, '微软雅黑') self.browser.settings().setFontFamily( QWebEngineSettings.CursiveFont, '微软雅黑') self.shortcutd = QShortcut(QKeySequence("Ctrl+="), self) self.shortcutd.activated.connect(self.zoom_in_func) self.shortcutu = QShortcut(QKeySequence("Ctrl+-"), self) self.shortcutu.activated.connect(self.zoom_out_func)
def initUI(self): left_layout = QVBoxLayout() left_layout.addWidget(self.btn_1) left_layout.addWidget(self.btn_2) left_layout.addWidget(self.btn_3) left_layout.setSizeConstraint(QLayout.SetFixedSize) left_widget = QWidget() left_widget.setLayout(left_layout) self.right_widget = QTabWidget() self.right_widget.tabBar().setObjectName("mainTab") self.right_widget.addTab(self.tab1, '') self.right_widget.addTab(self.tab2, '') self.right_widget.addTab(self.tab3, '') self.right_widget.setCurrentIndex(0) self.right_widget.setStyleSheet('''QTabBar::tab{width: 0; \ height: 0; margin: 0; padding: 0; border: none;}''') main_layout = QHBoxLayout() main_layout.addWidget(left_widget, alignment=Qt.Alignment(Qt.AlignLeft | Qt.AlignTop)) main_layout.addWidget(self.right_widget) main_layout.setContentsMargins(0, 0, 0, 0) main_widget = QWidget() main_widget.setLayout(main_layout) self.setCentralWidget(main_widget)
def showMessage(self, msg): """Procedure to update message in splash""" align = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) # color = QtGui.QColor(QtCore.Qt.White) color = QColor(0, 0, 0) QSplashScreen.showMessage(self, msg, align, color) QApplication.processEvents()
def __init_gui(self): self.setWindowTitle('Hill Climbing Method') individual_size_box = QHBoxLayout() individual_size_label = QLabel('Individual size:') individual_size_label.setMinimumWidth(150) self.individual_size_input = QLineEdit() individual_size_box.addWidget(individual_size_label, alignment=Qt.Alignment()) individual_size_box.addWidget(self.individual_size_input, alignment=Qt.Alignment()) self.solution_label = QLabel() self.solution_button = QPushButton('Solution', self) self.solution_button.clicked.connect(self.__solution_button_clicked) self.terminate_solution_button = QPushButton('Terminate solution', self) self.terminate_solution_button.clicked.connect( self.__terminate_solution) self.terminate_solution_button.setEnabled(False) self.statistics_label = QLabel() self.statistics_button = QPushButton('Statistics', self) self.statistics_button.clicked.connect( self.__statistics_button_clicked) self.terminate_statistics_button = QPushButton('Terminate statistics', self) self.terminate_statistics_button.clicked.connect( self.__terminate_statistics) self.terminate_statistics_button.setEnabled(False) self.solutions_buttons_box = QHBoxLayout() self.solutions_buttons_box.addWidget(self.solution_button, alignment=Qt.Alignment()) self.solutions_buttons_box.addWidget(self.terminate_solution_button, alignment=Qt.Alignment()) self.statistics_buttons_box = QHBoxLayout() self.statistics_buttons_box.addWidget(self.statistics_button, alignment=Qt.Alignment()) self.statistics_buttons_box.addWidget(self.terminate_statistics_button, alignment=Qt.Alignment()) self.qv_box_layout = QVBoxLayout() self.qv_box_layout.addLayout(individual_size_box) self.qv_box_layout.addWidget(self.solution_label, alignment=Qt.Alignment()) self.qv_box_layout.addWidget(self.statistics_label, alignment=Qt.Alignment()) self.qv_box_layout.addLayout(self.solutions_buttons_box) self.qv_box_layout.addLayout(self.statistics_buttons_box) self.setCentralWidget(QWidget(flags=Qt.WindowFlags())) self.centralWidget().setLayout(self.qv_box_layout)
def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget (QObject) """ super(BreakPointModel, self).__init__(parent) self.breakpoints = [] self.header = [ self.tr("Filename"), self.tr("Line"), self.tr('Condition'), self.tr('Temporary'), self.tr('Enabled'), self.tr('Ignore Count'), ] self.alignments = [ Qt.Alignment(Qt.AlignLeft), Qt.Alignment(Qt.AlignRight), Qt.Alignment(Qt.AlignLeft), Qt.Alignment(Qt.AlignHCenter), Qt.Alignment(Qt.AlignHCenter), Qt.Alignment(Qt.AlignRight), Qt.Alignment(Qt.AlignHCenter), ]
def __createSummaryItem(self, col0, col1): """ Private slot to create a new item in the summary list. @param col0 string for column 0 (string) @param col1 string for column 1 (string) """ itm = QTreeWidgetItem(self.summaryList, [col0, col1]) itm.setTextAlignment(1, Qt.Alignment(Qt.AlignRight))
def changeLegend(self, text): """Slot for turning off the legend, or changing its location.""" alignment = self.legend_cb.itemData(self.legend_cb.currentIndex()) if text == "No Legend": self.chart.legend().hide() else: self.chart.legend().setAlignment(Qt.Alignment(alignment)) self.chart.legend().show()
def __init__(self): """ Constructor """ pixmap = QPixmap(':/images/splash.png') self.labelAlignment = Qt.Alignment( Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) QSplashScreen.__init__(self, pixmap, Qt.WindowStaysOnTopHint) QApplication.flush()
def __init__(self): """ Constructor """ seeking = QPixmap(getPath('iconDir', 'splash.png')) self.labelAlignment = \ Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) QSplashScreen.__init__(self, seeking) self.show() QApplication.flush()
def __init__(self): super(WebPanel, self).__init__(flags=Qt.WindowFlags()) self.WebBrowserPanel = WebBrowserPanelWidget(self) self.WebBrowserPanel.setObjectName('WebBrowserPanel') self.WebBrowserPanel.setStyleSheet('background-color: transparent;') self.Layouts = QtWidgets.QHBoxLayout(self) self.Layouts.addWidget(self.WebBrowserPanel, alignment=Qt.Alignment()) self.Layouts.setSpacing(0) self.Layouts.setContentsMargins(0, 0, 0, 0) self.setLayout(self.Layouts)
def __init__(self, picfile): pixmap = QPixmap(picfile) # , Qt.WindowStaysOnTopHint) super(SplashScreen, self).__init__(pixmap) # self.setMask(splash_pix.mask()) # self.raise_() self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignHCenter | Qt.AlignAbsolute) self.show() QApplication.flush()
def __init__(self): """ Constructor """ ericPic = QPixmap( os.path.join(getConfig('ericPixDir'), 'ericSplash.png')) self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) super(SplashScreen, self).__init__(ericPic) self.show() QApplication.flush()
def __init_gui(self): self.setWindowTitle('Lab3-4') self.ea_button = QPushButton('Evolutionary Algorithm', self) self.ea_button.clicked.connect(self.__ea_button_clicked) self.hcm_button = QPushButton('Hill Climbing Method', self) self.hcm_button.clicked.connect(self.__hcm_button_clicked) self.pso_button = QPushButton('Particle Swarm Optimisation', self) self.pso_button.clicked.connect(self.__pso_button_clicked) self.qv_box_layout = QVBoxLayout() self.qv_box_layout.setContentsMargins(20, 20, 20, 20) self.qv_box_layout.addWidget(self.ea_button, alignment=Qt.Alignment()) self.qv_box_layout.addWidget(self.hcm_button, alignment=Qt.Alignment()) self.qv_box_layout.addWidget(self.pso_button, alignment=Qt.Alignment()) self.setCentralWidget(QWidget(flags=Qt.WindowFlags())) self.centralWidget().setLayout(self.qv_box_layout)
def __init__(self): """ Constructor """ img_path = os.path.join(os.getcwd(), 'gui', 'images', 'splash.png') pixmap = QPixmap(img_path) self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) QSplashScreen.__init__(self, pixmap) self.show() QApplication.flush()
def __init__(self, parent=None): super(CombinedValueRangeWidget, self).__init__(parent) self.roiWidgets = [] self.roiLayout = QGridLayout(self) self.setLayout(self.roiLayout) hbox = QHBoxLayout() hbox.addWidget(QLabel("min"), 0, Qt.Alignment(Qt.AlignLeft)) hbox.addWidget(QLabel("max"), 0, Qt.Alignment(Qt.AlignLeft)) self.roiLayout.addLayout(hbox, 0, 1) self.roiLayout.addWidget(QLabel("Export Full Range"), 0, 2) self.roiLayout.addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum), 0, 3) self.roiCheckBoxes = [] self.setFocusPolicy(Qt.TabFocus) self.lastInChain = super(CombinedValueRangeWidget, self).nextInFocusChain()
def add_row_all_table(table_widget): """ Add empty table row """ tot_rows = table_widget.rowCount() table_widget.insertRow(tot_rows) table_widget: QTableWidget table_widget.horizontalHeader().setStretchLastSection(True) table_widget.setWordWrap(True) table_widget.horizontalHeader().setDefaultAlignment( Qt.AlignCenter | Qt.Alignment(Qt.TextWordWrap))
def _init(self): central_widget = QWidget(flags=self.windowFlags()) self.setCentralWidget(central_widget) self.scroll_canvas = ScrollCanvas(central_widget) self.plot_canvas = PlotCanvas(self) self._menubar() self.scroll_canvas.setWidget(self.plot_canvas) self.scroll_canvas.setWidgetResizable(True) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) layout.addWidget(self.scroll_canvas, alignment=Qt.Alignment()) layout.addWidget(self.plot_canvas.toolbar, alignment=Qt.Alignment()) central_widget.setLayout(layout) palette = self.palette() palette.setColor(self.backgroundRole(), Qt.white) self.setPalette(palette)
def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget (QObject) """ super(WatchPointModel, self).__init__(parent) self.watchpoints = [] self.header = [ self.tr("Condition"), self.tr("Special"), self.tr('Temporary'), self.tr('Enabled'), self.tr('Ignore Count'), ] self.alignments = [Qt.Alignment(Qt.AlignLeft), Qt.Alignment(Qt.AlignLeft), Qt.Alignment(Qt.AlignHCenter), Qt.Alignment(Qt.AlignHCenter), Qt.Alignment(Qt.AlignRight), ]
def __createResultItem(self, parent, values): """ Private slot to create a new item in the result list. @param parent parent of the new item (QTreeWidget or QTreeWidgetItem) @param values values to be displayed (list) @return the generated item """ itm = QTreeWidgetItem(parent) for col in range(len(values)): itm.setData(col, Qt.DisplayRole, values[col]) for col in range(1, 7): itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) return itm
def _add_widgets(self,vbox,apps): row=int(len(self.appsWidgets)/self.maxCol) col=(self.maxCol*(row+1))-len(self.appsWidgets) sigmap_run=QSignalMapper(self) sigmap_run.mapped[QString].connect(self._launch) for appName,data in apps.items(): appIcon=data['Icon'] appDesc=data['Name'] if QtGui.QIcon.hasThemeIcon(appIcon): icnApp=QtGui.QIcon.fromTheme(appIcon) elif os.path.isfile(appIcon): iconPixmap=QtGui.QPixmap(appIcon) scaledIcon=iconPixmap.scaled(QSize(BTN_SIZE*1.2,BTN_SIZE*1.2)) icnApp=QtGui.QIcon(scaledIcon) elif appIcon.startswith("http"): if not os.path.isdir("%s/icons"%self.cache): os.makedirs("%s/icons"%self.cache) tmpfile=os.path.join("%s/icons"%self.cache,appIcon.split("/")[2].split(".")[0]) if not os.path.isfile(tmpfile): try: urlretrieve(appIcon,tmpfile) except: tmpfile=QtGui.QIcon.fromTheme("shell") iconPixmap=QtGui.QPixmap(tmpfile) scaledIcon=iconPixmap.scaled(QSize(BTN_SIZE*1.2,BTN_SIZE*1.2)) icnApp=QtGui.QIcon(scaledIcon) appIcon=tmpfile else: continue if not appName: continue self.app_icons[appName]=appIcon self._debug("Adding %s"%appName) btnApp=navButton(self) btnApp.setIcon(icnApp) btnApp.setIconSize(QSize(BTN_SIZE,BTN_SIZE)) btnApp.setToolTip(appDesc) btnApp.setFocusPolicy(Qt.NoFocus) btnApp.keypress.connect(self._set_focus) btnApp.focusIn.connect(self._get_focus) self.focusWidgets.append(btnApp) self.appsWidgets.append(appName) sigmap_run.setMapping(btnApp,appName) btnApp.clicked.connect(sigmap_run.map) vbox.addWidget(btnApp,row,col,Qt.Alignment(-1)) col+=1 if col==self.maxCol: col=0 row+=1
def _load_screen(self): box = QGridLayout() lbl_txt = QLabel(_("From here you can add Launchers")) box.addWidget(lbl_txt) lbl_icon = QLabel(_("Icon: ")) box.addWidget(lbl_icon, 1, 2, 1, 1) self.btn_icon = QPushButton() self.btn_icon.setObjectName("btnIcon") icn_desktop = QtGui.QIcon.fromTheme("shell") self.btn_icon.setIcon(icn_desktop) self.btn_icon.setIconSize(QSize(64, 64)) self.btn_icon.setToolTip(_("Push to change icon")) self.btn_icon.clicked.connect(lambda: self._file_chooser( widget=self.btn_icon, path="/usr/share/icons", imgDialog=True)) box.addWidget(self.btn_icon, 2, 2, 3, 1, Qt.AlignTop) lbl_name = QLabel(_("Name: ")) box.addWidget(lbl_name, 1, 0, 1, 2, Qt.AlignBottom) self.inp_name = QLineEdit() self.inp_name.setPlaceholderText(_("Desktop name")) self.inp_name.setToolTip(_("Insert desktop name")) box.addWidget(self.inp_name, 2, 0, 1, 2, Qt.AlignTop) lbl_exec = QLabel(_("Executable: ")) box.addWidget(lbl_exec, 3, 0, 1, 2, Qt.AlignTop) wdg = QWidget() hbox = QHBoxLayout() wdg.setLayout(hbox) self.inp_exec = QLineEdit() self.inp_exec.editingFinished.connect(self._get_icon) self.inp_exec.setPlaceholderText(_("Executable path")) self.inp_exec.setToolTip(_("Insert path to the executable")) self.inp_exec.setStyleSheet("margin:0px") hbox.addWidget(self.inp_exec, Qt.Alignment(0)) btn_exec = QPushButton("...") btn_exec.setObjectName("btnFile") btn_exec.setToolTip(_("Press button to select an executable")) btn_exec.clicked.connect( lambda: self._file_chooser(widget=self.inp_exec, path="/usr/bin")) btn_exec.setStyleSheet("margin:0px") hbox.addWidget(btn_exec) box.addWidget(wdg, 4, 0, 2, 1, Qt.AlignTop) lbl_desc = QLabel(_("Description: ")) box.addWidget(lbl_desc, 5, 0, 1, 2, Qt.AlignBottom) self.inp_desc = QLineEdit() self.inp_desc.setPlaceholderText(_("Description")) self.inp_desc.setToolTip(_("Insert a description for the app")) box.addWidget(self.inp_desc, 6, 0, 1, Qt.AlignTop) self.setLayout(box)
def __createResultItem(self, parent, values): """ Private slot to create a new item in the result list. @param parent parent of the new item (QTreeWidget or QTreeWidgetItem) @param values values to be displayed (list) @return the generated item """ data = [values[0]] for value in values[1:]: try: data.append("{0:5}".format(int(value))) except ValueError: data.append(value) itm = QTreeWidgetItem(parent, data) for col in range(1, 7): itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight)) return itm
def __init__(self): """ Constructor """ ericPic = QPixmap( os.path.join(getConfig('ericPixDir'), 'pymakrSplash.png')) self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) super(SplashScreen, self).__init__(ericPic) lblVersion = QLabel(self) lblVersion.setText(UI.Info.Version) lblVersion.adjustSize() lblVersion.setStyleSheet("QLabel { color : white; }") lblVersion.setAttribute(Qt.WA_TranslucentBackground) lblVersion.move(425 - lblVersion.width(), 195) self.show() self.raise_() # needed for mac QApplication.flush()
def updateUI(self): thema = self.m_themaComboBox.itemData(self.m_themaComboBox.currentIndex()) if self.m_chartView.chart().theme() != thema: self.m_chartView.chart().setTheme(thema) pal = self.window().palette() if thema == QChart.ChartThemeLight: pal.setColor(QPalette.Window, QColor(0xf0f0f0)) pal.setColor(QPalette.WindowText, QColor(0x404044)) elif thema == QChart.ChartThemeDark: pal.setColor(QPalette.Window, QColor(0x121218)) pal.setColor(QPalette.WindowText, QColor(0xd6d6d6)) self.window().setPalette(pal) options = QChart.AnimationOptions(QChart.AllAnimations) if self.m_chartView.chart().animationOptions() != options: self.m_chartView.chart().setAnimationOptions(options) label = self.m_chartView.chart().legend() labelPosition = self.m_labelComboBox.itemData(self.m_labelComboBox.currentIndex()) if labelPosition == 0: label.hide() else: label.setAlignment(Qt.Alignment(labelPosition)) label.show() indicatorMarker = self.m_indicatorMarkerComboBox.itemData( self.m_indicatorMarkerComboBox.currentIndex()) if label != indicatorMarker: label.setMarkerShape(indicatorMarker) showLabel = self.m_showLabelCheckBox.isChecked() self.m_chartView.chart().series()[0].setLabelsVisible(showLabel)