# добавляем виджеты label = QLabel("Надпись") button = QPushButton("OK") button_for_msg = QPushButton("Всплывающее окно") # Устанавливаем всплывающие подсказки для окна и кнопки QToolTip.setFont(QFont('Arial', 10)) win.setToolTip('This is a <b>QWidget</b> widget') button.setToolTip('This is a <b>QPushButton</b> widget') label.setToolTip('This is a <b>QLabel</b> widget') # вертикальная линия для привязки vertical_line = QVBoxLayout() # горизонтальная линия для привязки horizontal_line = QHBoxLayout() horizontal_line.addWidget(label, alignment=Qt.AlignCenter) # связываем две линии - к вертикальной добавляем горизонтальную vertical_line.addLayout(horizontal_line) horizontal_line2 = QHBoxLayout() horizontal_line2.addWidget(button, alignment=Qt.AlignCenter) horizontal_line2.addWidget(button_for_msg, alignment=Qt.AlignCenter) vertical_line.addLayout(horizontal_line2) # привязываем линию с надписью к окну win.setLayout(vertical_line) # добавляем вызов функций при действиях с виджетами def button_click():
def __init__(self, locale_keys: dict, icon_cache: Cache, manager: ApplicationManager, disk_cache: bool, download_icons: bool, screen_size, suggestions: bool, tray_icon=None): super(ManageWindow, self).__init__() self.locale_keys = locale_keys self.manager = manager self.tray_icon = tray_icon self.working = False # restrict the number of threaded actions self.apps = [] self.label_flatpak = None self.icon_cache = icon_cache self.disk_cache = disk_cache self.download_icons = download_icons self.screen_size = screen_size self.icon_flathub = QIcon(resource.get_path('img/logo.svg')) self.resize(ManageWindow.__BASE_HEIGHT__, ManageWindow.__BASE_HEIGHT__) self.setWindowIcon(self.icon_flathub) self.layout = QVBoxLayout() self.setLayout(self.layout) self.toolbar_top = QToolBar() self.toolbar_top.addWidget(self._new_spacer()) self.label_status = QLabel() self.label_status.setText('') self.label_status.setStyleSheet("font-weight: bold") self.toolbar_top.addWidget(self.label_status) self.toolbar_search = QToolBar() self.toolbar_search.setStyleSheet("spacing: 0px;") self.toolbar_search.setContentsMargins(0, 0, 0, 0) label_pre_search = QLabel() label_pre_search.setStyleSheet( "background: white; border-top-left-radius: 5px; border-bottom-left-radius: 5px;" ) self.toolbar_search.addWidget(label_pre_search) self.input_search = QLineEdit() self.input_search.setMaxLength(20) self.input_search.setFrame(False) self.input_search.setPlaceholderText( self.locale_keys['window_manage.input_search.placeholder'] + "...") self.input_search.setToolTip( self.locale_keys['window_manage.input_search.tooltip']) self.input_search.setStyleSheet( "QLineEdit { background-color: white; color: gray; spacing: 0;}") self.input_search.returnPressed.connect(self.search) self.toolbar_search.addWidget(self.input_search) label_pos_search = QLabel() label_pos_search.setPixmap(QPixmap( resource.get_path('img/search.svg'))) label_pos_search.setStyleSheet( "background: white; padding-right: 10px; border-top-right-radius: 5px; border-bottom-right-radius: 5px;" ) self.toolbar_search.addWidget(label_pos_search) self.ref_toolbar_search = self.toolbar_top.addWidget( self.toolbar_search) self.toolbar_top.addWidget(self._new_spacer()) self.layout.addWidget(self.toolbar_top) toolbar = QToolBar() self.checkbox_updates = QCheckBox() self.checkbox_updates.setText(self.locale_keys['updates'].capitalize()) self.checkbox_updates.stateChanged.connect(self._handle_updates_filter) self.ref_checkbox_updates = toolbar.addWidget(self.checkbox_updates) self.checkbox_only_apps = QCheckBox() self.checkbox_only_apps.setText( self.locale_keys['manage_window.checkbox.only_apps']) self.checkbox_only_apps.setChecked(True) self.checkbox_only_apps.stateChanged.connect( self._handle_filter_only_apps) self.ref_checkbox_only_apps = toolbar.addWidget( self.checkbox_only_apps) self.extra_filters = QWidget() self.extra_filters.setLayout(QHBoxLayout()) toolbar.addWidget(self.extra_filters) toolbar.addWidget(self._new_spacer()) self.bt_refresh = QToolButton() self.bt_refresh.setToolTip( locale_keys['manage_window.bt.refresh.tooltip']) self.bt_refresh.setIcon(QIcon(resource.get_path('img/refresh.svg'))) self.bt_refresh.clicked.connect( lambda: self.refresh_apps(keep_console=False)) toolbar.addWidget(self.bt_refresh) self.bt_upgrade = QToolButton() self.bt_upgrade.setToolTip( locale_keys['manage_window.bt.upgrade.tooltip']) self.bt_upgrade.setIcon( QIcon(resource.get_path('img/update_green.svg'))) self.bt_upgrade.setEnabled(False) self.bt_upgrade.clicked.connect(self.update_selected) self.ref_bt_upgrade = toolbar.addWidget(self.bt_upgrade) self.layout.addWidget(toolbar) self.table_apps = AppsTable(self, self.icon_cache, disk_cache=self.disk_cache, download_icons=self.download_icons) self.table_apps.change_headers_policy() self.layout.addWidget(self.table_apps) toolbar_console = QToolBar() self.checkbox_console = QCheckBox() self.checkbox_console.setText( self.locale_keys['manage_window.checkbox.show_details']) self.checkbox_console.stateChanged.connect(self._handle_console) self.checkbox_console.setVisible(False) self.ref_checkbox_console = toolbar_console.addWidget( self.checkbox_console) toolbar_console.addWidget(self._new_spacer()) self.layout.addWidget(toolbar_console) self.textarea_output = QPlainTextEdit(self) self.textarea_output.resize(self.table_apps.size()) self.textarea_output.setStyleSheet("background: black; color: white;") self.layout.addWidget(self.textarea_output) self.textarea_output.setVisible(False) self.textarea_output.setReadOnly(True) self.thread_update = UpdateSelectedApps(self.manager) self.thread_update.signal_output.connect(self._update_action_output) self.thread_update.signal_finished.connect( self._finish_update_selected) self.thread_update.signal_status.connect( self._change_updating_app_status) self.thread_refresh = RefreshApps(self.manager) self.thread_refresh.signal.connect(self._finish_refresh_apps) self.thread_uninstall = UninstallApp(self.manager, self.icon_cache) self.thread_uninstall.signal_output.connect(self._update_action_output) self.thread_uninstall.signal_finished.connect(self._finish_uninstall) self.thread_downgrade = DowngradeApp(self.manager, self.locale_keys) self.thread_downgrade.signal_output.connect(self._update_action_output) self.thread_downgrade.signal_finished.connect(self._finish_downgrade) self.thread_get_info = GetAppInfo(self.manager) self.thread_get_info.signal_finished.connect(self._finish_get_info) self.thread_get_history = GetAppHistory(self.manager, self.locale_keys) self.thread_get_history.signal_finished.connect( self._finish_get_history) self.thread_search = SearchApps(self.manager) self.thread_search.signal_finished.connect(self._finish_search) self.thread_install = InstallApp(manager=self.manager, disk_cache=self.disk_cache, icon_cache=self.icon_cache, locale_keys=self.locale_keys) self.thread_install.signal_output.connect(self._update_action_output) self.thread_install.signal_finished.connect(self._finish_install) self.thread_animate_progress = AnimateProgress() self.thread_animate_progress.signal_change.connect( self._update_progress) self.thread_verify_models = VerifyModels() self.thread_verify_models.signal_updates.connect( self._notify_model_data_change) self.thread_refresh_app = RefreshApp(manager=self.manager) self.thread_refresh_app.signal_finished.connect(self._finish_refresh) self.thread_refresh_app.signal_output.connect( self._update_action_output) self.thread_suggestions = FindSuggestions(man=self.manager) self.thread_suggestions.signal_finished.connect(self._finish_search) self.toolbar_bottom = QToolBar() self.toolbar_bottom.setIconSize(QSize(16, 16)) self.label_updates = QLabel() self.ref_label_updates = self.toolbar_bottom.addWidget( self.label_updates) self.toolbar_bottom.addWidget(self._new_spacer()) self.progress_bar = QProgressBar() self.progress_bar.setTextVisible(False) self.ref_progress_bar = self.toolbar_bottom.addWidget( self.progress_bar) self.toolbar_bottom.addWidget(self._new_spacer()) bt_about = QToolButton() bt_about.setStyleSheet('QToolButton { border: 0px; }') bt_about.setIcon(QIcon(resource.get_path('img/about.svg'))) bt_about.clicked.connect(self._show_about) bt_about.setToolTip(self.locale_keys['manage_window.bt_about.tooltip']) self.ref_bt_about = self.toolbar_bottom.addWidget(bt_about) self.layout.addWidget(self.toolbar_bottom) self.centralize() self.filter_only_apps = True self.filter_types = set() self.filter_updates = False self._maximized = False self.dialog_about = None self.first_refresh = suggestions self.thread_warnings = ListWarnings(man=manager, locale_keys=locale_keys) self.thread_warnings.signal_warnings.connect(self._show_warnings)
def initUI(self): self.topsquare = QFrame(self) self.topsquare.setGeometry(0, 0, 800, 1200) #self.topsquare.setStyleSheet("QWidget { background-color: #AEECF0 }") #self.topsquare.setStyleSheet("QWidget { background-color: rgb(35,58,58) }") #add lcds to prog ''' 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space ''' #self.lcds = [QLCDNumber(self),QLCDNumber(self), # QLCDNumber(self),QLCDNumber(self)] self.lcds = [QLabel(self), QLabel(self), QLabel(self), QLabel(self)] Ubox = QHBoxLayout() self.verticalLayoutR = QVBoxLayout() self.verticalLayoutR.setSpacing(0) self.exitFrame = QFrame(self) self.exitFrame.setStyleSheet("background-color: #AEECF0;") #self.exitFrame.setFrameShape(QFrame.StyledPanel) #self.exitFrame.setFrameShadow(QFrame.Raised) self.exitverticalLayout = QHBoxLayout(self.exitFrame) self.exitverticalLayout.setSpacing(0) for lcd in self.lcds: #lcd.display(' ') lcd.setStyleSheet( "background-color: rgb(35,58,58); font-size:50px;font: bold 50px; color: #AEECF0" ) lcd.setAlignment(Qt.AlignCenter) lcd.setText(' ') Ubox.addWidget(lcd) self.exitverticalLayout.addWidget(lcd) self.topLbl = QLabel(self.exitFrame) self.topLbl.setWordWrap(True) self.topLbl.setAlignment(Qt.AlignCenter) self.topLbl.setGeometry(9, 9, 760, 280) self.messageShowEnterPin() self.verticalLayoutR.addWidget(self.exitFrame) #add buttons to prog names = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['Clear', '0', 'OK']] Uboxes = [QHBoxLayout(), QHBoxLayout(), QHBoxLayout(), QHBoxLayout()] #set output Vbox = QVBoxLayout() Vbox.setSpacing(0) Vbox.setContentsMargins(-1, -1, -1, -1) Vbox.addLayout(self.verticalLayoutR) #for box in Uboxes: # Vbox.addLayout(box) for box, name in zip(Uboxes, names): nLayoutR = QVBoxLayout() nLayoutR.setContentsMargins(-1, -1, -1, -1) nLayoutR.setSpacing(0) nFrame = QFrame(self) nFrame.setStyleSheet("background-color: #AEECF0;") #nFrame.setFrameShape(QFrame.StyledPanel) #nFrame.setFrameShadow(QFrame.Raised) box = QHBoxLayout(nFrame) for n in name: button = QPushButton(n, self) palette = button.palette() palette.setColor(button.backgroundRole(), QColor(35, 58, 58)) button.setPalette(palette) button.setStyleSheet( "background-color: #233A3A; font-size:70px;font: bold 90px; color: #AEECF0" ) button.setAutoFillBackground(True) #button.setFlat(True) button.setMinimumHeight(220) if n == 'Clear': button.clicked.connect(self.clearClicked) elif n == 'OK': button.clicked.connect(self.okClicked) else: button.clicked.connect(self.buttonClicked) #button.setAutoFillBackground(True) box.addWidget(button) nLayoutR.addWidget(nFrame) Vbox.addLayout(nLayoutR) self.setStyleSheet("QPushButton{color:#AEECF0;font: bold 70px; }") self.setStyleSheet("QVBoxLayout { background-color: #AEECF0 }") #self.setStyleSheet("background: rgb(35,58,58)") self.setLayout(Vbox) self.showFullScreen()
def __init__(self, mainWindow=None, handler=None, parent=None): super(ControlWindow, self).__init__(parent=parent) self.handler = handler self.mainWindow = mainWindow self.activeFrames = [] self.activeGaussians = [] self.frame_toggle = True self.gaussian_toggle = True self.heatmap_toggle = True self.AOIs_toggle = True self.AOILines_toggle = True self.gaze_paths_toggle = True self.horizontalLayout = QHBoxLayout(self) self.sliderX = Slider(0, self.handler.aois[0][:, -1].max()) self.sliderX.slider.setValue(0) self.horizontalLayout.addWidget(self.sliderX) self.sliderX.slider.valueChanged.connect( lambda: self.translateX(self.sliderX.slider.value())) # self.sliderY = Slider(0, self.handler.frame_size[1]) v = .5 * self.handler.frame_size[1] self.sliderY.slider.setValue(v) self.translateY(v) self.horizontalLayout.addWidget(self.sliderY) self.sliderY.slider.valueChanged.connect( lambda: self.translateY(self.sliderY.slider.value())) # self.sliderZ = Slider(0, self.handler.frame_size[0]) v = .5 * self.handler.frame_size[0] self.sliderZ.slider.setValue(v) self.translateZ(v) self.horizontalLayout.addWidget(self.sliderZ) self.sliderZ.slider.valueChanged.connect( lambda: self.translateZ(self.sliderZ.slider.value())) # # vertical button layout self.buttonLayout = QVBoxLayout() spacer = QSpacerItem(10, 30) self.buttonLayout.addItem(spacer) # button to de/activate aois: self.buttonAOIs = QCheckBox('aois (volume)') self.buttonAOIs.setChecked(True) self.buttonAOIs.clicked.connect(self.toggleAOIs) self.buttonLayout.addWidget(self.buttonAOIs) # button to de/activate aois: self.buttonAOIs = QCheckBox('aois (line)') self.buttonAOIs.setChecked(True) self.buttonAOIs.clicked.connect(self.toggleAOILines) self.buttonLayout.addWidget(self.buttonAOIs) # button to de/activate gaze paths: self.buttonGaze = QCheckBox('gaze paths') self.buttonGaze.setChecked(True) self.buttonGaze.clicked.connect(self.toggleGaze) self.buttonLayout.addWidget(self.buttonGaze) # button to de/activate heatmaps: self.buttonHeatmap = QCheckBox('heatmaps') self.buttonHeatmap.setChecked(True) self.buttonHeatmap.clicked.connect(self.toggleHeatmaps) self.buttonLayout.addWidget(self.buttonHeatmap) # button to de/activate gaussians: self.buttonGaussian = QCheckBox('gaze points') self.buttonGaussian.setChecked(True) self.buttonGaussian.clicked.connect(self.toggleGaussians) self.buttonLayout.addWidget(self.buttonGaussian) # button to de/activate gaussians: self.buttonFrame = QCheckBox('video frames') self.buttonFrame.setChecked(True) self.buttonFrame.clicked.connect(self.toggleFrames) self.buttonLayout.addWidget(self.buttonFrame) self.buttonLayout.addStretch() self.horizontalLayout.addLayout(self.buttonLayout) # vertical selection box layout self.selectionLayout = QVBoxLayout() spacer = QSpacerItem(10, 30) self.selectionLayout.addItem(spacer) self.aoiSelection = QToolButton() self.aoiSelection.setText('select AOI (volume)') self.aoiSelectionMenu = QMenu() for t in self.handler.aoi_titles: a = self.aoiSelectionMenu.addAction(t) a.setCheckable(True) a.setChecked(True) a.changed.connect(self.toggleSingleAOIs) self.aoiSelection.setMenu(self.aoiSelectionMenu) self.aoiSelection.setPopupMode(QToolButton.InstantPopup) self.selectionLayout.addWidget(self.aoiSelection) self.aoiLineSelection = QToolButton() self.aoiLineSelection.setText('select AOI (lines)') self.aoiLineSelectionMenu = QMenu() for t in self.handler.aoi_titles: a = self.aoiLineSelectionMenu.addAction(t) a.setCheckable(True) a.setChecked(True) a.changed.connect(self.toggleSingleAOILines) self.aoiLineSelection.setMenu(self.aoiLineSelectionMenu) self.aoiLineSelection.setPopupMode(QToolButton.InstantPopup) self.selectionLayout.addWidget(self.aoiLineSelection) self.gazePathsSelection = QToolButton() self.gazePathsSelection.setText('select gaze paths') self.gazePathsSelectionMenu = QMenu() for t in self.handler.gp_titles: a = self.gazePathsSelectionMenu.addAction(t) a.setCheckable(True) a.setChecked(True) a.changed.connect(self.toggleSingleGazePath) self.gazePathsSelection.setMenu(self.gazePathsSelectionMenu) self.gazePathsSelection.setPopupMode(QToolButton.InstantPopup) self.selectionLayout.addWidget(self.gazePathsSelection) self.label = QLabel('specify key frames') self.lineEdit = QLineEdit() self.lineEditButton = QPushButton('ok') self.lineEditButton.clicked.connect(self.updateKeyFrames) self.selectionLayout.addWidget(self.label) self.selectionLayout.addWidget(self.lineEdit) self.selectionLayout.addWidget(self.lineEditButton) self.selectionLayout.addStretch() self.horizontalLayout.addLayout(self.selectionLayout) spacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding) #self.horizontalLayout.addItem(spacer) self.show()
appctxt = ApplicationContext() # 1. Instantiate ApplicationContext # create a Widget to hold all the upcoming subwidgets myWindow = QWidget() myWindow.setWindowTitle("Canny Edge Tutorial") ### create the layout. ### Design is two horizontal layout widgets. ### The left one hosts the inputs. ### The right one hosts the outpus. layout = QHBoxLayout() ### create the input V layout # is a Vertical Layout widget and hosts: # QLineEdit to read the filepath of image # QSliders for lower and upper thresholds input_layout = QVBoxLayout() ### create the input widgets ### LineEdit for reading image filepath read_filepath = QLineEdit()
def layoutUI(self): # layout principal self.principalLayout = QHBoxLayout(self) # primer Frame self.firstFrame = QFrame(self) self.firstFrame.setFrameShape(QFrame.StyledPanel) self.firstFrame.setFrameShadow(QFrame.Raised) self.firstFrame.setObjectName("contenedor1") # Frame II self.second_Frame = QFrame() self.second_Frame.setObjectName("contenedor2") # Layouts self.verticalLayout = QVBoxLayout(self.firstFrame) self.gridLayout = QGridLayout() self.grafic_principal = QVBoxLayout(self.second_Frame) self.grafic_plot = QVBoxLayout() self.layout_button = QGridLayout() self.text_title = QLabel( "Análisis de Simulación de coste - efectividad en el\ntratamiento de la esquizofrenia") self.text_title.setAlignment(QtCore.Qt.AlignCenter) self.text_title.setObjectName("tittle") self.grafic_principal.addWidget(self.text_title) self.text_salida = QLabel( "Salidas") self.text_salida.setAlignment(QtCore.Qt.AlignCenter) self.text_salida.setObjectName("salida") labels = {(1,0):"Ziprasidona", (2,0):"Risperidona", (3,0):"Haloperidol",(4,0):"Olanzapina",(5,0):"Clozapina",(6,1):""} self.lbl_costo = QLabel("COSTO $") self.lbl_costo.setAlignment(QtCore.Qt.AlignCenter) self.gridLayout.addWidget(self.lbl_costo, 0, 1) a = database.CargarDatos() self.text_ziprasidona = QLineEdit(str(a[0][2])) self.text_ziprasidona.setAlignment(QtCore.Qt.AlignCenter) self.text_ziprasidona.setEnabled(False) self.gridLayout.addWidget(self.text_ziprasidona, 1, 1) self.text_Risperidona = QLineEdit(str(a[1][2])) self.text_Risperidona.setAlignment(QtCore.Qt.AlignCenter) self.text_Risperidona.setEnabled(False) self.gridLayout.addWidget(self.text_Risperidona, 2, 1) self.text_haloperidol = QLineEdit(str(a[2][2])) self.text_haloperidol.setAlignment(QtCore.Qt.AlignCenter) self.text_haloperidol.setEnabled(False) self.gridLayout.addWidget(self.text_haloperidol, 3, 1) self.text_olanzapina = QLineEdit(str(a[3][2])) self.text_olanzapina.setAlignment(QtCore.Qt.AlignCenter) self.text_olanzapina.setEnabled(False) self.gridLayout.addWidget(self.text_olanzapina, 4, 1) self.text_clozapina = QLineEdit(str(a[4][2])) self.text_clozapina.setEnabled(False) self.text_clozapina.setAlignment(QtCore.Qt.AlignCenter) self.gridLayout.addWidget(self.text_clozapina, 5, 1) for pos, name in labels.items(): x, y = pos lbl = QLabel(self.firstFrame) lbl.setText(name) self.gridLayout.addWidget(lbl, x, y) self.verticalLayout.addLayout(self.gridLayout) self.principalLayout.addWidget(self.firstFrame) #? Parte de la Grafica self.graphWidget = PlotWidget() self.graphWidget.showGrid(x = True, y = True) self.graphWidget.addLegend() self.graphWidget.setTitle("Entrada",color="w", size="22px") styles = {"color": "#fff", "font-size": "23px"} self.graphWidget.setLabel("left", " Pr (la intervención es óptima) ", **styles) self.graphWidget.setLabel("bottom", "Financiamiento disponible para IMSS", **styles) self.grafic_plot.addWidget(self.graphWidget) self.grafic_principal.addLayout(self.grafic_plot) self.principalLayout.addWidget(self.second_Frame) self.verticalLayout.addWidget(self.text_salida) #! Tabla self.table = QTableWidget(5, 4,self.firstFrame) self.table.setHorizontalHeaderLabels(['TRATAMIENTO ', 'PRESENTACIÓN ', 'PRECIO IMSS ','COSTO DIARIO ']) self.table.setAlternatingRowColors(True) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.setSelectionBehavior(QTableWidget.SelectRows) self.table.setSelectionMode(QTableWidget.SingleSelection) self.verticalLayout.addWidget(self.table) #! Boton self.start_simulation = QPushButton(" Iniciar simulación") self.start_simulation.clicked.connect(self.event_simulation) self.start_simulation.setObjectName("buttonsim") self.button_save = QPushButton("Guardar plot") self.button_save.setObjectName("save") self.button_save.hide() self.button_save.clicked.connect(self.saveFig) self.grafic_plot.addWidget(self.button_save) self.layout_button.addWidget(self.start_simulation,0,1) self.verticalLayout.addLayout(self.layout_button)
def __init__(self, parent): super().__init__(parent) self.setAcceptDrops(True) self.parent_widget = parent self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) self._widget_layout = QHBoxLayout(self) # widget stuff self._d_widget = QWidget(self) self._widget_layout.addWidget(self._d_widget) self.main_layout = QVBoxLayout(self._d_widget) self.main_layout.setSpacing(0) self.main_layout.setContentsMargins(0, 0, 0, 0) self.arrow_handle = misc.ArrowHandle(self) self.arrow_handle.CLICKED.connect(self.slide) self._widget_layout.addWidget(self.arrow_handle) self.setContentsMargins(0, 0, -self.arrow_handle.width(), 0) self.show_all_galleries_btn = QPushButton("Show all galleries") self.show_all_galleries_btn.clicked.connect( lambda: parent.manga_list_view.sort_model.set_gallery_list()) self.show_all_galleries_btn.clicked.connect( self.show_all_galleries_btn.hide) self.show_all_galleries_btn.hide() self.main_layout.addWidget(self.show_all_galleries_btn) self.main_buttons_layout = QHBoxLayout() self.main_layout.addLayout(self.main_buttons_layout) # buttons self.lists_btn = QPushButton("Lists") self.artist_btn = QPushButton("Artists") self.ns_tags_btn = QPushButton("NS && Tags") self.main_buttons_layout.addWidget(self.lists_btn) self.main_buttons_layout.addWidget(self.artist_btn) self.main_buttons_layout.addWidget(self.ns_tags_btn) # buttons contents self.stacked_layout = QStackedLayout() self.main_layout.addLayout(self.stacked_layout) # lists gallery_lists_dummy = QWidget(self) self.lists = GalleryLists(self) create_new_list_btn = QPushButton() create_new_list_btn.setIcon(QIcon(app_constants.PLUS_PATH)) create_new_list_btn.setIconSize(QSize(15, 15)) create_new_list_btn.clicked.connect( lambda: self.lists.create_new_list()) create_new_list_btn.adjustSize() create_new_list_btn.setFixedSize(create_new_list_btn.width(), create_new_list_btn.height()) create_new_list_btn.setToolTip("Create a new list!") lists_l = QVBoxLayout(gallery_lists_dummy) lists_l.setContentsMargins(0, 0, 0, 0) lists_l.setSpacing(0) lists_l.addWidget(self.lists) lists_l.addWidget(create_new_list_btn) lists_index = self.stacked_layout.addWidget(gallery_lists_dummy) self.lists.GALLERY_LIST_CLICKED.connect( parent.manga_list_view.sort_model.set_gallery_list) self.lists.GALLERY_LIST_CLICKED.connect( self.show_all_galleries_btn.show) self.lists.GALLERY_LIST_REMOVED.connect( self.show_all_galleries_btn.click) self.lists_btn.clicked.connect( lambda: self.stacked_layout.setCurrentIndex(lists_index)) self.show_all_galleries_btn.clicked.connect(self.lists.clearSelection) self.show_all_galleries_btn.clicked.connect(self.lists._reset_selected) # artists self.artists_list = GalleryArtistsList( parent.manga_list_view.gallery_model, self) self.artists_list.artist_clicked.connect( lambda a: parent.search('artist:"{}"'.format(a))) artists_list_index = self.stacked_layout.addWidget(self.artists_list) self.artist_btn.clicked.connect( lambda: self.stacked_layout.setCurrentIndex(artists_list_index)) #self.lists.GALLERY_LIST_CLICKED.connect(self.artists_list.set_current_glist) self.show_all_galleries_btn.clicked.connect( self.artists_list.clearSelection) #self.show_all_galleries_btn.clicked.connect(lambda:self.artists_list.set_current_glist()) # ns_tags self.tags_tree = TagsTreeView(self) self.tags_tree.TAG_SEARCH.connect(parent.search) self.tags_tree.NEW_LIST.connect(self.lists.create_new_list) self.tags_tree.setHeaderHidden(True) self.show_all_galleries_btn.clicked.connect( self.tags_tree.clearSelection) self.tags_layout = QVBoxLayout(self.tags_tree) ns_tags_index = self.stacked_layout.addWidget(self.tags_tree) self.ns_tags_btn.clicked.connect( lambda: self.stacked_layout.setCurrentIndex(ns_tags_index)) if parent.manga_list_view.gallery_model.db_emitter._finished: self.tags_tree.setup_tags() self.lists.setup_lists() else: parent.manga_list_view.gallery_model.db_emitter.DONE.connect( self.tags_tree.setup_tags) parent.manga_list_view.gallery_model.db_emitter.DONE.connect( self.lists.setup_lists) self.slide_animation = misc.create_animation(self, "maximumSize") self.slide_animation.stateChanged.connect(self._slide_hide) self.slide_animation.setEasingCurve(QEasingCurve.InOutQuad)
def setUpUI(self): self.Vlayout = QVBoxLayout(self) self.Hlayout1 = QHBoxLayout() self.Hlayout2 = QHBoxLayout() self.formlayout = QFormLayout() self.label1 = QLabel("用户名: ") labelFont = QFont() labelFont.setPixelSize(18) lineEditFont = QFont() lineEditFont.setPixelSize(16) self.label1.setFont(labelFont) self.lineEdit1 = QLineEdit() self.lineEdit1.setFixedHeight(32) self.lineEdit1.setFixedWidth(180) self.lineEdit1.setFont(lineEditFont) self.lineEdit1.setMaxLength(10) self.formlayout.addRow(self.label1, self.lineEdit1) self.label2 = QLabel("密 码: ") self.label2.setFont(labelFont) self.lineEdit2 = QLineEdit() self.lineEdit2.setFixedHeight(32) self.lineEdit2.setFixedWidth(180) self.lineEdit2.setMaxLength(16) # 设置验证 reg = QRegExp("PB[0~9]{8}") pValidator = QRegExpValidator(self) pValidator.setRegExp(reg) self.lineEdit1.setValidator(pValidator) reg = QRegExp("[a-zA-z0-9]+$") pValidator.setRegExp(reg) self.lineEdit2.setValidator(pValidator) passwordFont = QFont() passwordFont.setPixelSize(10) self.lineEdit2.setFont(passwordFont) self.lineEdit2.setEchoMode(QLineEdit.Password) self.formlayout.addRow(self.label2, self.lineEdit2) self.signIn = QPushButton("登 录") self.signIn.setFixedWidth(80) self.signIn.setFixedHeight(30) self.signIn.setFont(labelFont) self.formlayout.addRow("", self.signIn) self.label = QLabel("欢迎使用银河智维AI平台") fontlabel = QFont() fontlabel.setPixelSize(30) self.label.setFixedWidth(390) # self.label.setFixedHeight(80) self.label.setFont(fontlabel) self.Hlayout1.addWidget(self.label, Qt.AlignCenter) self.widget1 = QWidget() self.widget1.setLayout(self.Hlayout1) self.widget2 = QWidget() self.widget2.setFixedWidth(300) self.widget2.setFixedHeight(150) self.widget2.setLayout(self.formlayout) self.Hlayout2.addWidget(self.widget2, Qt.AlignCenter) self.widget = QWidget() self.widget.setLayout(self.Hlayout2) self.Vlayout.addWidget(self.widget1) self.Vlayout.addWidget(self.widget, Qt.AlignTop) self.signIn.clicked.connect(self.signInCheck) self.lineEdit2.returnPressed.connect(self.signInCheck) self.lineEdit1.returnPressed.connect(self.signInCheck)
def __init__(self, app, *__args): super().__init__(*__args) self.app = app self.emulator = self.app.dwarf.emulator self.until_address = 0 layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self._toolbar = QToolBar() self._toolbar.addAction('Start', self.handle_start) self._toolbar.addAction('Step', self.handle_step) self._toolbar.addAction('Stop', self.handle_stop) self._toolbar.addAction('Clear', self.handle_clear) self._toolbar.addAction('Options', self.handle_options) layout.addWidget(self._toolbar) self.tabs = QTabWidget() self.assembly = DisassemblyView(self.app) self.assembly.display_jumps = False self.assembly.follow_jumps = False self.memory_table = MemoryPanel(self.app) self.memory_table._read_only = True self.tabs.addTab(self.assembly, 'Code') self.tabs.addTab(self.memory_table, 'Memory') layout.addWidget(self.tabs) h_box = QHBoxLayout() self.ranges_list = DwarfListView(self.app) self.ranges_list.doubleClicked.connect(self.ranges_item_double_clicked) self._ranges_model = QStandardItemModel(0, 2) self._ranges_model.setHeaderData(0, Qt.Horizontal, 'Memory') self._ranges_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._ranges_model.setHeaderData(1, Qt.Horizontal, 'Size') self.ranges_list.setModel(self._ranges_model) self._access_list = DwarfListView(self.app) self._access_list.doubleClicked.connect(self.access_item_double_clicked) self._access_model = QStandardItemModel(0, 3) self._access_model.setHeaderData(0, Qt.Horizontal, 'Address') self._access_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._access_model.setHeaderData(1, Qt.Horizontal, 'Access') self._access_model.setHeaderData(1, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._access_model.setHeaderData(2, Qt.Horizontal, 'Value') self._access_list.setModel(self._access_model) h_box.addWidget(self.ranges_list) h_box.addWidget(self._access_list) layout.addLayout(h_box) self.setLayout(layout) self.console = self.app.console.get_emu_console() self.emulator.onEmulatorStart.connect(self.on_emulator_start) self.emulator.onEmulatorStop.connect(self.on_emulator_stop) # self.emulator.onEmulatorStep.connect(self.on_emulator_step) self.emulator.onEmulatorHook.connect(self.on_emulator_hook) self.emulator.onEmulatorMemoryHook.connect(self.on_emulator_memory_hook) self.emulator.onEmulatorMemoryRangeMapped.connect(self.on_emulator_memory_range_mapped) self.emulator.onEmulatorLog.connect(self.on_emulator_log) self._require_register_result = None self._last_instruction_address = 0
def __init__(self, parent, receiver_slot, settings, video_dict={}): super().__init__(parent, receiver_slot, settings, video_dict) self.setWindowTitle(QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video Finder')) self.size_label.hide() # empty lists for no_audio and no_video and video_audio files self.no_audio_list = [] self.no_video_list = [] self.video_audio_list = [] self.media_title = '' # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # extension_label self.extension_label = QLabel(self.link_frame) self.change_name_horizontalLayout.addWidget(self.extension_label) # Fetch Button self.url_submit_pushButtontton = QPushButton(self.link_frame) self.link_horizontalLayout.addWidget(self.url_submit_pushButtontton) # Status Box self.status_box_textEdit = QTextEdit(self.link_frame) self.status_box_textEdit.setMaximumHeight(150) self.link_verticalLayout.addWidget(self.status_box_textEdit) # Select format horizontal layout select_format_horizontalLayout = QHBoxLayout() # Selection Label select_format_label = QLabel(self.link_frame) select_format_horizontalLayout.addWidget(select_format_label) # Selection combobox self.media_comboBox = QComboBox(self.link_frame) self.media_comboBox.setMinimumWidth(200) select_format_horizontalLayout.addWidget(self.media_comboBox) # Duration label self.duration_label = QLabel(self.link_frame) select_format_horizontalLayout.addWidget(self.duration_label) self.format_selection_frame = QFrame(self) self.format_selection_frame.setLayout(select_format_horizontalLayout) self.link_verticalLayout.addWidget(self.format_selection_frame) # advanced_format_selection_checkBox self.advanced_format_selection_checkBox = QCheckBox(self) self.link_verticalLayout.addWidget(self.advanced_format_selection_checkBox) # advanced_format_selection_frame self.advanced_format_selection_frame = QFrame(self) self.link_verticalLayout.addWidget(self.advanced_format_selection_frame) advanced_format_selection_horizontalLayout = QHBoxLayout(self.advanced_format_selection_frame) # video_format_selection self.video_format_selection_label = QLabel(self.advanced_format_selection_frame) self.video_format_selection_comboBox = QComboBox(self.advanced_format_selection_frame) # audio_format_selection self.audio_format_selection_label = QLabel(self.advanced_format_selection_frame) self.audio_format_selection_comboBox = QComboBox(self.advanced_format_selection_frame) for widget in [self.video_format_selection_label, self.video_format_selection_comboBox, self.audio_format_selection_label, self.audio_format_selection_comboBox]: advanced_format_selection_horizontalLayout.addWidget(widget) # Set Texts self.url_submit_pushButtontton.setText(QCoreApplication.translate("ytaddlink_src_ui_tr", 'Fetch Media List')) select_format_label.setText(QCoreApplication.translate("ytaddlink_src_ui_tr", 'Select a format')) self.video_format_selection_label.setText(QCoreApplication.translate("ytaddlink_src_ui_tr", 'Video format:')) self.audio_format_selection_label.setText(QCoreApplication.translate("ytaddlink_src_ui_tr", 'Audio format:')) self.advanced_format_selection_checkBox.setText( QCoreApplication.translate("ytaddlink_src_ui_tr", 'Advanced options')) # Add Slot Connections self.url_submit_pushButtontton.setEnabled(False) self.change_name_lineEdit.setEnabled(False) self.ok_pushButton.setEnabled(False) self.download_later_pushButton.setEnabled(False) self.format_selection_frame.setEnabled(True) self.advanced_format_selection_frame.setEnabled(False) self.advanced_format_selection_checkBox.toggled.connect(self.advancedFormatFrame) self.url_submit_pushButtontton.clicked.connect(self.submitClicked) self.media_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'video_audio')) self.video_format_selection_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'video')) self.audio_format_selection_comboBox.activated.connect( partial(self.mediaSelectionChanged, 'audio')) self.link_lineEdit.textChanged.disconnect(super().linkLineChanged) # Should be disconnected. self.link_lineEdit.textChanged.connect(self.linkLineChangedHere) self.setMinimumSize(650, 480) self.status_box_textEdit.hide() self.format_selection_frame.hide() self.advanced_format_selection_frame.hide() self.advanced_format_selection_checkBox.hide() if 'link' in video_dict.keys() and video_dict['link']: self.link_lineEdit.setText(video_dict['link']) self.url_submit_pushButtontton.setEnabled(True) else: # check clipboard clipboard = QApplication.clipboard() text = clipboard.text() if (("tp:/" in text[2:6]) or ("tps:/" in text[2:7])): self.link_lineEdit.setText(str(text)) self.url_submit_pushButtontton.setEnabled(True)
def initUI(self): widget = QWidget() self.setCentralWidget(widget) hboxLayout = QHBoxLayout() widget.setLayout(hboxLayout) vboxWidget = QWidget() vboxLayout = QVBoxLayout() vboxWidget.setLayout(vboxLayout) hboxLayout.addWidget(vboxWidget) self.textField = QTextEdit() hboxLayout.addWidget(self.textField) fontSizeCb = QComboBox() for i in range(1, 42): fontSizeCb.addItem(str(i)) fontSizeCb.setCurrentText(str(12)) fontSizeCb.currentTextChanged.connect(self.changeFontSize) vboxLayout.addWidget(fontSizeCb) options = ['Times New Roman', 'Arial', 'Courier New'] rb = [QRadioButton(o) for o in options] cbg = QButtonGroup(self) cbg.setExclusive(True) for id, ch in enumerate(options): rb = QRadioButton(ch) if id == 1: rb.setChecked(True) cbg.addButton(rb) cbg.setId(rb, id) vboxLayout.addWidget(rb) cbg.buttonClicked.connect(self.changeFontType) self.textField.setFont(QFont('Arial', 12)) # colorGrid = QGridLayout() # colorPallete = QWidget() # colorPallete.setLayout(colorGrid) # vboxLayout.addWidget(colorPallete) # pb = [QPushButton(str(i)) for i in range(1, 20)] # for i in range(0, 3): # colorGrid.addWidget(pb[i * 5], i, 0) # colorGrid.addWidget(pb[i * 5 + 1], i, 1) # colorGrid.addWidget(pb[i * 5 + 2], i, 2) # colorGrid.addWidget(pb[i * 5 + 3], i, 3) # colorGrid.addWidget(pb[i * 5 + 4], i, 4) exitAction = QAction('Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(self.close) openAction = QAction('Open', self) openAction.setShortcut('Ctrl+O') openAction.setStatusTip('Open file') openAction.triggered.connect(self.openFile) newAction = QAction('New', self) newAction.setShortcut('Ctrl+N') newAction.setStatusTip('New') newAction.triggered.connect(self.newFile) saveAction = QAction('Save', self) saveAction.setShortcut('Ctrl+S') saveAction.setStatusTip('Save') saveAction.triggered.connect(self.saveFile) saveAsAction = QAction('Save As', self) saveAsAction.setStatusTip('Save As') saveAsAction.triggered.connect(self.saveFileDialog) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(newAction) fileMenu.addAction(openAction) fileMenu.addAction(saveAction) fileMenu.addAction(saveAsAction) fileMenu.addAction(exitAction) cutAction = QAction('Cut', self) cutAction.setStatusTip('Cut') cutAction.setShortcut('Ctrl+X') cutAction.triggered.connect(self.cut) copyAction = QAction('Copy', self) cutAction.setStatusTip('Copy') cutAction.setShortcut('Ctrl+C') cutAction.triggered.connect(self.copy) editionMenu = menubar.addMenu('&Edition') editionMenu.addAction(cutAction) editionMenu.addAction(copyAction) toolbar = self.addToolBar('') toolbar.addAction(newAction) toolbar.addAction(openAction) toolbar.addAction(saveAction) toolbar.addAction(saveAsAction) toolbar.addAction(exitAction) self.setGeometry(500, 500, 500, 500) self.setWindowTitle('Notepad') self.show()
def edit(self): logging.debug('edit() called BinanceSched') interval_str, interval_index, offset, log_state = self.config self.binance_sched_layout = QVBoxLayout() self.confirm_button = QPushButton(QC.translate('', 'Ok')) self.interval_txt = QLabel() self.interval_txt.setText( QC.translate('', 'Choose the scheduler interval')) # https://github.com/sammchardy/python-binance/blob/master/binance/client.py self.selectInterval = QComboBox() self.selectInterval.addItem(QC.translate('', '1 Minute'), QVariant('1m')) self.selectInterval.addItem(QC.translate('', '3 Minutes'), QVariant('3m')) self.selectInterval.addItem(QC.translate('', '5 Minutes'), QVariant('5m')) self.selectInterval.addItem(QC.translate('', '15 Minutes'), QVariant('15m')) self.selectInterval.addItem(QC.translate('', '30 Minutes'), QVariant('30m')) self.selectInterval.addItem(QC.translate('', '1 Hour'), QVariant('1h')) self.selectInterval.addItem(QC.translate('', '2 Hours'), QVariant('2h')) self.selectInterval.addItem(QC.translate('', '4 Hours'), QVariant('4h')) self.selectInterval.addItem(QC.translate('', '6 Hours'), QVariant('6h')) self.selectInterval.addItem(QC.translate('', '8 Hours'), QVariant('8h')) self.selectInterval.addItem(QC.translate('', '12 Hours'), QVariant('12h')) self.selectInterval.addItem(QC.translate('', '1 Day'), QVariant('1d')) self.selectInterval.setCurrentIndex(interval_index) self.offset_txt = QLabel() self.offset_txt.setText( QC.translate( '', 'Enter time offset [s] (default: 0; range: -999s to + 999s)')) self.offset_input = QLineEdit() self.offset_input.setValidator(QIntValidator(-999, 999)) self.offset_input.setText(str(offset)) self.help_text = QWidget() self.help_text_layout = QVBoxLayout(self.help_text) self.help_text_1 = QLabel() self.help_text_1.setText( QC.translate( '', 'Synchronize with Binance and execute subsequent modules')) self.help_text_2 = QLabel() self.help_text_2.setText( QC.translate('', 'after expiration of the selected interval.')) self.help_text_layout.addWidget(self.help_text_1) self.help_text_layout.addWidget(self.help_text_2) self.log_line = QWidget() self.ask_for_logging = QLabel() self.ask_for_logging.setText(QC.translate('', 'Log output?')) self.log_checkbox = QCheckBox() self.log_line_layout = QHBoxLayout(self.log_line) self.log_line_layout.addWidget(self.ask_for_logging) self.log_line_layout.addWidget(self.log_checkbox) self.log_line_layout.addStretch(1) if log_state: self.log_checkbox.setChecked(True) self.binance_sched_edit = ElementEditor(self) self.binance_sched_edit.setWindowTitle( QC.translate('', 'Edit Binance Scheduler')) # signals and slots self.confirm_button.clicked.connect(self.binance_sched_edit.closeEvent) self.binance_sched_edit.window_closed.connect(self.edit_done) self.binance_sched_layout.addWidget(self.interval_txt) self.binance_sched_layout.addWidget(self.selectInterval) self.binance_sched_layout.addWidget(self.offset_txt) self.binance_sched_layout.addWidget(self.offset_input) self.binance_sched_layout.addWidget(self.log_line) self.binance_sched_layout.addWidget(self.help_text) self.binance_sched_layout.addStretch(1) self.binance_sched_layout.addWidget(self.confirm_button) self.binance_sched_edit.setLayout(self.binance_sched_layout) self.binance_sched_edit.show()
def initUi(self): outerFrame = QtWidgets.QFrame() outerFrame.setFrameShape(QFrame.Panel) outerFrame.setFrameShadow(QFrame.Raised) outerFrameLayout = QHBoxLayout() outerFrame.setLayout(outerFrameLayout) outerFrameLayout.setSpacing(10) outerFrameLayout.setContentsMargins(20, 20, 20, 20) # Left top right then bottom frameDouble = QtWidgets.QFrame() doubleFrameSizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) doubleFrameSizePolicy.setHorizontalStretch(1) frameDouble.setSizePolicy(doubleFrameSizePolicy) frameDoubleVLayout = QVBoxLayout() frameDouble.setLayout(frameDoubleVLayout) innerFrame = QtWidgets.QFrame(self, objectName="innerFrameLogin") innerFrame.setFrameShape(QFrame.Panel) innerFrame.setFrameShadow(QFrame.Raised) innerFrame.setStyleSheet("""QFrame{ background: rgba(90,90,90,100); border-width: 1px; border-style: outset; border-color: rgba(130,130,130,100); border-radius: 35px;}""") innerFrameLayout = QVBoxLayout() innerFrameLayout.setSpacing(30) innerFrameLayout.setContentsMargins(20, 20, 20, 20) innerFrame.setLayout(innerFrameLayout) formBlock = QtWidgets.QWidget() formBlockSizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) formBlock.setSizePolicy(formBlockSizePolicy) formBlockLayout = QGridLayout() formBlock.setLayout(formBlockLayout) loginLabel = QtWidgets.QLabel("STC2", objectName="loginLabel") loginLabel.setAlignment(Qt.AlignCenter) loginLabel.setStyleSheet("""font-size: 100px;""") loginLabelSizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) loginLabel.setSizePolicy(loginLabelSizePolicy) #Makes logo label and places logo image inside it logoLabel = QtWidgets.QLabel() logoLabel.setStyleSheet("""background: rgba(90,90,90,0); border-color: rgba(140,140,140,0);""") logoLabelSizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed) #Horizontal,vertical logoLabel.setSizePolicy(logoLabelSizePolicy) pixmap = QPixmap("Logo.ico") logoLabel.setPixmap(pixmap) logoLabel.setAlignment(Qt.AlignCenter) widgetUsername = QtWidgets.QWidget( ) #below border-radius 35px works but onnly for username widgetUsername.setStyleSheet(""" background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(96,99,108,200), stop:1 rgba(133,131,142,200)); border-width: 1px; border-style: outset; border-color: rgba(140,140,140,100); border-radius: 30px; """) widgetUsernameSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical widgetUsername.setSizePolicy(widgetUsernameSizePolicy) usernameLayout = QHBoxLayout() widgetUsername.setLayout(usernameLayout) widgetEmail = QtWidgets.QWidget() widgetEmail.setStyleSheet(""" background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(96,99,108,200), stop:1 rgba(133,131,142,200)); border-width: 1px; border-style: outset; border-color: rgba(140,140,140,100); border-radius: 30px; """) widgetEmailSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical widgetEmail.setSizePolicy(widgetEmailSizePolicy) emailLayout = QHBoxLayout() widgetEmail.setLayout(emailLayout) widgetPassword = QtWidgets.QWidget() widgetPassword.setStyleSheet(""" background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(96,99,108,200), stop:1 rgba(133,131,142,200)); border-width: 1px; border-style: outset; border-color: rgba(140,140,140,100); border-radius: 30px; """) widgetPasswordSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical widgetPassword.setSizePolicy(widgetPasswordSizePolicy) passwordLayout = QHBoxLayout() widgetPassword.setLayout(passwordLayout) widgetConfirmPassword = QtWidgets.QWidget() widgetConfirmPassword.setStyleSheet(""" background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(96,99,108,200), stop:1 rgba(133,131,142,200)); border-width: 1px; border-style: outset; border-color: rgba(140,140,140,100); border-radius: 30px; """) widgetConfirmPasswordSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical widgetConfirmPassword.setSizePolicy(widgetConfirmPasswordSizePolicy) confirmPasswordLayout = QHBoxLayout() widgetConfirmPassword.setLayout(confirmPasswordLayout) self.usernameLineEditLogin = QtWidgets.QLineEdit() self.usernameLineEditLogin.setStyleSheet( """color: rgba(255,255,255,255); background:rgba(69, 83, 105,0); border-color: rgba(14,14,14,0); border-radius: 20px; font-size: 15px;""") self.usernameLineEditLogin.setPlaceholderText("Username") self.emailLineEditLogin = QtWidgets.QLineEdit() self.emailLineEditLogin.setStyleSheet("""color: rgba(255,255,255,255); background:rgba(69, 83, 105,0); border-color: rgba(14,14,14,0); border-radius: 20px; font-size: 15px;""") self.emailLineEditLogin.setPlaceholderText("Email Address") self.passwordLineEditLogin = QtWidgets.QLineEdit() self.passwordLineEditLogin.setPlaceholderText("Password") self.passwordLineEditLogin.setEchoMode(2) self.passwordLineEditLogin.setStyleSheet( """color: rgba(255,255,255,255); background:rgba(69, 83, 105,0); border-color: rgba(14,14,14,0); border-radius: 20px; font-size: 15px;""") self.confirmPasswordLineEditLogin = QtWidgets.QLineEdit() self.confirmPasswordLineEditLogin.setPlaceholderText( "Confirm Password") self.confirmPasswordLineEditLogin.setEchoMode(2) self.confirmPasswordLineEditLogin.setStyleSheet( """color: rgba(255,255,255,255); background:rgba(69, 83, 105,0); border-color: rgba(14,14,14,0); border-radius: 20px; font-size: 15px;""") usernameLogoLabel = QtWidgets.QLabel() usernameLogoLabel.setStyleSheet("""background:rgba(156, 165, 179,255); border-color: rgba(14,14,14,0); border-radius: 23px;""") usernameLogoLabelSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) #Horizontal,vertical usernameLogoLabel.setSizePolicy(usernameLogoLabelSizePolicy) pixmap = QPixmap("48px.png") usernameLogoLabel.setPixmap(pixmap) usernameLogoLabel.setAlignment(Qt.AlignCenter) emailLogoLabel = QtWidgets.QLabel() emailLogoLabel.setStyleSheet("""background:rgba(156, 165, 179,255); border-color: rgba(14,14,14,0); border-radius: 23px;""") emailLogoLabelSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical emailLogoLabel.setSizePolicy(emailLogoLabelSizePolicy) pixmap = QPixmap("email2_48px.png") emailLogoLabel.setPixmap(pixmap) emailLogoLabel.setAlignment(Qt.AlignCenter) passwordLogoLabel = QtWidgets.QLabel() passwordLogoLabel.setStyleSheet("""background:rgba(156, 165, 179,255); border-color: rgba(14,14,14,0); border-radius: 23px;""") passwordLogoLabelSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) #Horizontal,vertical passwordLogoLabel.setSizePolicy(passwordLogoLabelSizePolicy) pixmap = QPixmap("lock2_48px.png") passwordLogoLabel.setPixmap(pixmap) passwordLogoLabel.setAlignment(Qt.AlignCenter) confirmPasswordLogoLabel = QtWidgets.QLabel() confirmPasswordLogoLabel.setStyleSheet( """background:rgba(156, 165, 179,255); border-color: rgba(14,14,14,0); border-radius: 23px;""") confirmPasswordLogoLabelSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Minimum) #Horizontal,vertical confirmPasswordLogoLabel.setSizePolicy( confirmPasswordLogoLabelSizePolicy) pixmap = QPixmap("lock2_48px.png") confirmPasswordLogoLabel.setPixmap(pixmap) confirmPasswordLogoLabel.setAlignment(Qt.AlignCenter) usernameLayout.addWidget(usernameLogoLabel) usernameLayout.addWidget(self.usernameLineEditLogin) emailLayout.addWidget(emailLogoLabel) emailLayout.addWidget(self.emailLineEditLogin) passwordLayout.addWidget(passwordLogoLabel) passwordLayout.addWidget(self.passwordLineEditLogin) confirmPasswordLayout.addWidget(confirmPasswordLogoLabel) confirmPasswordLayout.addWidget(self.confirmPasswordLineEditLogin) showPasswordCheck = QtWidgets.QCheckBox("Show Password") showPasswordCheck.setStyleSheet("""QCheckBox::indicator { border: 3px solid #5A5A5A; background: none; } """) registerButton = QtWidgets.QPushButton("Register") registerButtonSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical registerButton.setSizePolicy(registerButtonSizePolicy) registerButton.setStyleSheet(""" QPushButton{font-size: 15px; color: rgba(60,70,89,225); background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(188, 192, 204,200), stop:1 rgba(205,208,220,225)); border-width: 1px; border-style: outset; border-color: rgba(240,240,240,200); border-radius: 16px; min-height:30px; max-height:35px;} QPushButton:hover { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(205,208,220,225), stop:1 rgba(188, 192, 204,200)); } QPushButton:pressed { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(185,188,200,225), stop:1 rgba(168, 172, 184,200)); border-style: inset; } """) registerButton.clicked.connect(self.registerButtonClicked) returnButton = QtWidgets.QPushButton("Return to Mainpage") returnButtonSizePolicy = QSizePolicy( QSizePolicy.Minimum, QSizePolicy.Maximum) #Horizontal,vertical returnButton.setSizePolicy(returnButtonSizePolicy) returnButton.setStyleSheet(""" QPushButton{font-size: 15px; color: rgba(60,70,89,225); background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(188, 192, 204,200), stop:1 rgba(205,208,220,225)); border-width: 1px; border-style: outset; border-color: rgba(240,240,240,200); border-radius: 16px; min-height:30px; max-height:35px;} QPushButton:hover { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(205,208,220,225), stop:1 rgba(188, 192, 204,200)); } QPushButton:pressed { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 rgba(185,188,200,225), stop:1 rgba(168, 172, 184,200)); border-style: inset; } """) returnButton.clicked.connect(self.returnButtonClicked) formBlockLayout.addWidget(widgetUsername, 0, 0, 1, 2) formBlockLayout.addWidget(widgetEmail, 1, 0, 1, 2) formBlockLayout.addWidget(widgetPassword, 2, 0, 1, 2) formBlockLayout.addWidget(widgetConfirmPassword, 3, 0, 1, 2) formBlockLayout.addWidget(showPasswordCheck, 4, 0, 1, 2, Qt.AlignRight) formBlockLayout.addWidget(registerButton, 5, 0, 1, 1) formBlockLayout.addWidget(returnButton, 5, 1, 1, 1) innerFrameLayout.addWidget(logoLabel, Qt.AlignCenter) innerFrameLayout.addWidget(formBlock) frameDoubleVLayout.addWidget(loginLabel, Qt.AlignCenter) frameDoubleVLayout.addWidget(innerFrame, Qt.AlignCenter) outerFrameLayout.insertStretch(0, 1) outerFrameLayout.addWidget(frameDouble) outerFrameLayout.addStretch(1) mainGrid = QGridLayout() mainGrid.setSpacing(10) mainGrid.addWidget(outerFrame) outerWidgetBox = QtWidgets.QWidget() outerWidgetBox.setLayout(mainGrid) self.setCentralWidget(outerWidgetBox) self.setWindowTitle("Register") self.showMaximized()
def __init__(self, account: Optional[AbstractAccount], tx: Transaction, main_window: 'ElectrumWindow', desc: Optional[str], prompt_if_unsaved: bool, payment_request: Optional[PaymentRequest] = None) -> None: '''Transactions in the wallet will show their description. Pass desc to give a description for txs not yet in the wallet. ''' # We want to be a top-level window QDialog.__init__(self, parent=None, flags=Qt.WindowSystemMenuHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) # Take a copy; it might get updated in the main window by the FX thread. If this # happens during or after a long sign operation the signatures are lost. self.tx = copy.deepcopy(tx) if desc is not None: self.tx.description = desc self._tx_hash = tx.hash() self._main_window = main_window self._wallet = main_window._wallet self._account = account self._account_id = account.get_id() if account is not None else None self._payment_request = payment_request self._coin_service = CoinService(self._wallet) self._prompt_if_unsaved = prompt_if_unsaved self._saved = False self.setMinimumWidth(1000) self.setWindowTitle(_("Transaction")) self._monospace_font = QFont(platform.monospace_font) self._change_brush = QBrush( ColorScheme.YELLOW.as_color(background=True)) self._receiving_brush = QBrush( ColorScheme.GREEN.as_color(background=True)) self._broken_brush = QBrush(ColorScheme.RED.as_color(background=True)) form = FormSectionWidget() vbox = QVBoxLayout() vbox.addWidget(form) self.setLayout(vbox) self.tx_hash_e = ButtonsLineEdit() self.tx_hash_e.addButton("qrcode.png", self._on_click_show_tx_hash_qr, _("Show as QR code")) self.tx_hash_e.addButton("copy.png", self._on_click_copy_tx_id, _("Copy to clipboard")) self.tx_hash_e.setReadOnly(True) form.add_row(_("Transaction ID"), self.tx_hash_e, True) self.tx_desc = QLabel() form.add_row(_("Description"), self.tx_desc) self.status_label = QLabel() form.add_row(_('Status'), self.status_label) self.date_label = QLabel() form.add_row(_("Date"), self.date_label) self.amount_label = QLabel() form.add_row(_("Amount"), self.amount_label) self.size_label = QLabel() form.add_row(_("Size"), self.size_label) self.fee_label = QLabel() form.add_row(_("Fee"), self.fee_label) if self.tx.locktime > 0: form.add_row(_("Lock time"), QLabel(str(self.tx.locktime))) self._add_io(vbox) self.sign_button = b = QPushButton(_("Sign")) b.clicked.connect(self.sign) self.broadcast_button = b = QPushButton(_("Broadcast")) b.clicked.connect(self.do_broadcast) self.save_button = b = QPushButton(_("Save")) b.clicked.connect(self.save) self.cancel_button = b = QPushButton(_("Close")) b.clicked.connect(self.close) b.setDefault(True) self.qr_button = b = QPushButton() b.setIcon(read_QIcon("qrcode.png")) b.clicked.connect(self._show_qr) self.copy_button = QPushButton(_("Copy")) self.copy_button.clicked.connect(self.copy_tx_to_clipboard) self.cosigner_button = b = QPushButton(_("Send to cosigner")) b.clicked.connect(self.cosigner_send) # Action buttons self.buttons = [ self.cosigner_button, self.sign_button, self.broadcast_button, self.cancel_button ] # Transaction sharing buttons self.sharing_buttons = [ self.copy_button, self.qr_button, self.save_button ] hbox = QHBoxLayout() hbox.addLayout(Buttons(*self.sharing_buttons)) hbox.addStretch(1) hbox.addLayout(Buttons(*self.buttons)) vbox.addLayout(hbox) self.update() # connect slots so we update in realtime as blocks come in, etc main_window.history_updated_signal.connect(self.update_tx_if_in_wallet) main_window.network_signal.connect(self._on_transaction_verified) main_window.transaction_added_signal.connect( self._on_transaction_added)
def __init__(self, *args): super().__init__(BrickletIndustrialDualAnalogIn, *args) self.analog_in = self.device # the firmware version of a EEPROM Bricklet can (under common circumstances) # not change during the lifetime of an EEPROM Bricklet plugin. therefore, # it's okay to make final decisions based on it here self.has_fixed_calibration = self.firmware_version >= (2, 0, 1) self.cbe_voltage0 = CallbackEmulator(self, self.analog_in.get_voltage, 0, self.cb_voltage, self.increase_error_count, pass_arguments_to_result_callback=True) self.cbe_voltage1 = CallbackEmulator(self, self.analog_in.get_voltage, 1, self.cb_voltage, self.increase_error_count, pass_arguments_to_result_callback=True) self.calibration = None self.sample_rate_label = QLabel('Sample Rate:') self.sample_rate_combo = QComboBox() self.sample_rate_combo.addItem('976 Hz') self.sample_rate_combo.addItem('488 Hz') self.sample_rate_combo.addItem('244 Hz') self.sample_rate_combo.addItem('122 Hz') self.sample_rate_combo.addItem('61 Hz') self.sample_rate_combo.addItem('4 Hz') self.sample_rate_combo.addItem('2 Hz') self.sample_rate_combo.addItem('1 Hz') self.current_voltage = [CurveValueWrapper(), CurveValueWrapper()] # float, V self.calibration_button = QPushButton('Calibration...') self.sample_rate_combo.currentIndexChanged.connect(self.sample_rate_combo_index_changed) self.calibration_button.clicked.connect(self.calibration_button_clicked) plots = [('Channel 0', Qt.red, self.current_voltage[0], format_voltage), ('Channel 1', Qt.blue, self.current_voltage[1], format_voltage)] self.plot_widget = PlotWidget('Voltage [V]', plots, y_resolution=0.001) hlayout = QHBoxLayout() hlayout.addWidget(self.sample_rate_label) hlayout.addWidget(self.sample_rate_combo) hlayout.addStretch() hlayout.addWidget(self.calibration_button) line = QFrame() line.setObjectName("line") line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) layout = QVBoxLayout(self) layout.addWidget(self.plot_widget) layout.addWidget(line) layout.addLayout(hlayout)
def __init__(self, handler, data): '''Ask user for 2nd factor authentication. Support text and security card methods. Use last method from settings, but support downgrade. ''' QDialog.__init__(self, handler.top_level_window()) self.handler = handler self.txdata = data self.idxs = self.txdata[ 'keycardData'] if self.txdata['confirmationType'] > 1 else '' self.setMinimumWidth(650) self.setWindowTitle(_("Ledger Wallet Authentication")) self.cfg = copy.deepcopy(self.handler.win.wallet.get_keystore().cfg) self.dongle = self.handler.win.wallet.get_keystore().get_client( ).dongle self.pin = '' self.devmode = self.getDevice2FAMode() if self.devmode == 0x11 or self.txdata['confirmationType'] == 1: self.cfg['mode'] = 0 vbox = QVBoxLayout() self.setLayout(vbox) def on_change_mode(idx): self.cfg[ 'mode'] = 0 if self.devmode == 0x11 else idx if idx > 0 else 1 if self.cfg['mode'] > 0: self.handler.win.wallet.get_keystore().cfg = self.cfg self.handler.win.wallet.save_keystore() self.update_dlg() def return_pin(): self.pin = self.pintxt.text( ) if self.txdata['confirmationType'] == 1 else self.cardtxt.text() if self.cfg['mode'] == 1: self.pin = ''.join(chr(int(str(i), 16)) for i in self.pin) self.accept() self.modebox = QWidget() modelayout = QHBoxLayout() self.modebox.setLayout(modelayout) modelayout.addWidget(QLabel(_("Method:"))) self.modes = QComboBox() modelayout.addWidget(self.modes, 2) modelayout.addStretch(1) self.modebox.setMaximumHeight(50) vbox.addWidget(self.modebox) self.populate_modes() self.modes.currentIndexChanged.connect(on_change_mode) self.helpmsg = QTextEdit() self.helpmsg.setStyleSheet( "QTextEdit { color:black; background-color: lightgray; }") self.helpmsg.setReadOnly(True) vbox.addWidget(self.helpmsg) self.pinbox = QWidget() pinlayout = QHBoxLayout() self.pinbox.setLayout(pinlayout) self.pintxt = PasswordLineEdit() self.pintxt.setMaxLength(4) self.pintxt.returnPressed.connect(return_pin) pinlayout.addWidget(QLabel(_("Enter PIN:"))) pinlayout.addWidget(self.pintxt) pinlayout.addWidget(QLabel(_("NOT DEVICE PIN - see above"))) pinlayout.addStretch(1) self.pinbox.setVisible(self.cfg['mode'] == 0) vbox.addWidget(self.pinbox) self.cardbox = QWidget() card = QVBoxLayout() self.cardbox.setLayout(card) self.addrtext = QTextEdit() self.addrtext.setStyleSheet(''' QTextEdit { color:blue; background-color:lightgray; padding:15px 10px; border:none; font-size:20pt; font-family: "Courier New", monospace; } ''') self.addrtext.setReadOnly(True) self.addrtext.setMaximumHeight(130) card.addWidget(self.addrtext) def pin_changed(s): if len(s) < len(self.idxs): i = self.idxs[len(s)] addr = self.txdata['address'] if not constants.net.TESTNET: text = addr[:i] + '<u><b>' + addr[ i:i + 1] + '</u></b>' + addr[i + 1:] else: # pin needs to be created from mainnet address addr_mainnet = bitcoin.script_to_address( bitcoin.address_to_script(addr), net=constants.BitcoinMainnet) addr_mainnet = addr_mainnet[:i] + '<u><b>' + addr_mainnet[ i:i + 1] + '</u></b>' + addr_mainnet[i + 1:] text = str(addr) + '\n' + str(addr_mainnet) self.addrtext.setHtml(str(text)) else: self.addrtext.setHtml(_("Press Enter")) pin_changed('') cardpin = QHBoxLayout() cardpin.addWidget(QLabel(_("Enter PIN:"))) self.cardtxt = PasswordLineEdit() self.cardtxt.setMaxLength(len(self.idxs)) self.cardtxt.textChanged.connect(pin_changed) self.cardtxt.returnPressed.connect(return_pin) cardpin.addWidget(self.cardtxt) cardpin.addWidget(QLabel(_("NOT DEVICE PIN - see above"))) cardpin.addStretch(1) card.addLayout(cardpin) self.cardbox.setVisible(self.cfg['mode'] == 1) vbox.addWidget(self.cardbox) self.update_dlg()
def __init__(self, callback, flashgot_add_link_dictionary={}): super().__init__() self.callback = callback self.flashgot_add_link_dictionary = flashgot_add_link_dictionary #add change_name field self.change_name_horizontalLayout = QHBoxLayout() self.change_name_checkBox = QCheckBox(self.link_frame) self.change_name_checkBox.setText('Change File Name : ') self.change_name_horizontalLayout.addWidget(self.change_name_checkBox) self.change_name_lineEdit = QLineEdit(self.link_frame) self.change_name_horizontalLayout.addWidget(self.change_name_lineEdit) self.link_verticalLayout.addLayout(self.change_name_horizontalLayout) #entry initialization f = Open(setting_file) setting_file_lines = f.readlines() f.close() setting_dict_str = str(setting_file_lines[0].strip()) setting_dict = ast.literal_eval(setting_dict_str) global connections connections = int(setting_dict['connections']) global download_path download_path = str(setting_dict['download_path']) global init_file init_file = str( home_address ) + "/.config/persepolis_download_manager/addlink_init_file" os.system("touch " + init_file) f = Open(init_file) init_file_lines = f.readlines() f.close() #initialization self.connections_spinBox.setValue(connections) self.download_folder_lineEdit.setText(download_path) self.download_folder_lineEdit.setEnabled(False) self.ok_pushButton.setEnabled(False) self.link_lineEdit.textChanged.connect(self.linkLineChanged) #AddLink - checking clipboard for link! if 'link' in self.flashgot_add_link_dictionary: self.link_lineEdit.setText( str(self.flashgot_add_link_dictionary['link'])) del self.flashgot_add_link_dictionary['link'] else: clipboard = QApplication.clipboard() text = clipboard.text() try: if ("tp:/" in text[2:6]) or ("tps:/" in text[2:7]): self.link_lineEdit.setText(str(text)) except: pass #ip_lineEdit initialization try: self.ip_lineEdit.setText(init_file_lines[0].strip()) except: pass #proxy user lineEdit initialization try: self.proxy_user_lineEdit.setText(init_file_lines[2].strip()) except: pass #port_spinBox initialization try: self.port_spinBox.setValue(int(init_file_lines[1].strip())) except: pass #download UserName initialization try: self.download_user_lineEdit.setText(init_file_lines[3].strip()) except: pass #connect folder_pushButton self.folder_pushButton.clicked.connect(self.changeFolder) #connect OK and canel button self.cancel_pushButton.clicked.connect(self.cancelButtonPressed) self.ok_pushButton.clicked.connect(self.okButtonPressed) #frames and checkBoxes self.proxy_frame.setEnabled(False) self.proxy_checkBox.toggled.connect(self.proxyFrame) self.download_frame.setEnabled(False) self.download_checkBox.toggled.connect(self.downloadFrame) self.limit_frame.setEnabled(False) self.limit_checkBox.toggled.connect(self.limitFrame) self.start_frame.setEnabled(False) self.start_checkBox.toggled.connect(self.startFrame) self.end_frame.setEnabled(False) self.end_checkBox.toggled.connect(self.endFrame) self.change_name_lineEdit.setEnabled(False) self.change_name_checkBox.toggled.connect(self.changeName) #check name of flashgot link if 'out' in self.flashgot_add_link_dictionary: self.change_name_lineEdit.setText( str(self.flashgot_add_link_dictionary['out'])) self.change_name_checkBox.setChecked(True) del self.flashgot_add_link_dictionary['out']
def _init_ui(self): self.layout = QHBoxLayout(self) self.setLayout(self.layout)
def initUI(self): self.setGeometry(300, 300, 300, 300) self.setWindowTitle('LinLog | Settings') self.setWindowIcon(QIcon('logo.png')) style = "QWidget{background-color:" + self.settingsDict[ 'background-color'] + "; color:" + self.settingsDict['color'] + ";}" self.setStyleSheet(style) # declaration tab self.tab = QtWidgets.QTabWidget() self.general_tab = QWidget() self.cluster_tab = QWidget() self.tci_tab = QWidget() self.io_tab = QWidget() self.service_widget = QWidget() # self.tab.addTab(self.general_tab, "General") self.tab.addTab(self.cluster_tab, "Cluster") self.tab.addTab(self.tci_tab, "TCI") self.tab.addTab(self.io_tab, "Log file") self.tab.addTab(self.service_widget, "Services") # create General Tab formstyle = "background: "+self.settingsDict['form-background']+"; color: "+\ self.settingsDict['color-table']+"; " self.general_tab.layout = QVBoxLayout(self) # create vertical lay self.call_label = QLabel("You Callsign") self.call_input = QLineEdit() self.call_input.setFixedWidth(100) self.call_input.setStyleSheet(formstyle) # Chekbox SWL self.swl_chekbox = QCheckBox("Enable SWL mode") self.swl_chekbox.setStyleSheet("QCheckBox{ color:" + self.settingsDict['color'] + "; font-size: 12px;}") self.dlg = QColorDialog(self) self.back_color_label = QLabel("Window color") self.back_color_label.setStyleSheet(self.label_style) self.back_color_input = QPushButton() self.back_color_input.clicked.connect(self.back_color_select) self.back_color_input.setFixedWidth(70) self.back_color_input.setStyleSheet( "background:" + self.settingsDict['background-color'] + "; color:" + self.settingsDict['background-color'] + ";") self.back_color_input.setText(self.settingsDict['background-color']) #self.back_color_input.setStyleSheet(formstyle) self.text_color_label = QLabel("Text color") self.text_color_label.setStyleSheet(self.label_style) self.text_color_input = QPushButton() self.text_color_input.clicked.connect(self.text_color_select) self.text_color_input.setFixedWidth(70) self.text_color_input.setStyleSheet("background:" + self.settingsDict['color'] + "; color:" + self.settingsDict['color'] + ";") self.text_color_input.setText(self.settingsDict['color']) #self.text_color_input.setStyleSheet(formstyle) self.form_color_label = QLabel("Form background color") self.form_color_label.setStyleSheet(self.label_style) self.form_color_input = QPushButton() self.form_color_input.clicked.connect(self.form_color_select) self.form_color_input.setFixedWidth(70) self.form_color_input.setStyleSheet( "background: " + self.settingsDict['form-background'] + "; color:" + self.settingsDict['form-background'] + ";") self.form_color_input.setText(self.settingsDict['form-background']) # self.text_form_color_label = QLabel("Form text color") self.text_form_color_label.setStyleSheet(self.label_style) self.text_form_color_button = QPushButton() self.text_form_color_button.clicked.connect( self.form_text_color_select) self.text_form_color_button.setFixedWidth(70) self.text_form_color_button.setStyleSheet( "background: " + self.settingsDict['color-table'] + "; color: " + self.settingsDict['color-table'] + ";") self.text_form_color_button.setText(self.settingsDict['color-table']) # setup all elements to vertical lay self.general_tab.layout.addWidget(self.call_label) self.general_tab.layout.addWidget(self.call_input) self.general_tab.layout.addSpacing(20) self.general_tab.layout.addWidget(self.swl_chekbox) self.general_tab.layout.addWidget(self.back_color_label) self.general_tab.layout.addWidget(self.back_color_input) self.general_tab.layout.addSpacing(20) self.general_tab.layout.addWidget(self.text_color_label) self.general_tab.layout.addWidget(self.text_color_input) self.general_tab.layout.addSpacing(20) self.general_tab.layout.addWidget(self.form_color_label) self.general_tab.layout.addWidget(self.form_color_input) self.general_tab.layout.addWidget(self.text_form_color_label) self.general_tab.layout.addWidget(self.text_form_color_button) self.general_tab.setLayout(self.general_tab.layout) # create Cluster tab self.cluster_tab.layout = QVBoxLayout(self) self.cluster_host = QLabel("Cluster host:") self.cluster_host_input = QLineEdit() self.cluster_host_input.setFixedWidth(150) self.cluster_host_input.setStyleSheet(formstyle) self.cluster_port = QLabel("Cluster port:") self.cluster_port_input = QLineEdit() self.cluster_port_input.setFixedWidth(50) self.cluster_port_input.setStyleSheet(formstyle) self.host_port_lay = QHBoxLayout() # create host:port lay self.host_lay = QVBoxLayout() self.host_lay.addWidget(self.cluster_host) self.host_lay.addWidget(self.cluster_host_input) self.port_lay = QVBoxLayout() self.port_lay.addWidget(self.cluster_port) self.port_lay.addWidget(self.cluster_port_input) self.host_port_lay.addLayout(self.host_lay) self.host_port_lay.addLayout(self.port_lay) # Create calibrate cluster self.calibrate_lay = QHBoxLayout() ## Create text label self.text_and_button_Vlay = QVBoxLayout() text = "Press \"Start claibrate\" and select Callsign and Freq \n" \ "from the received line from the telnet cluster" self.message_label = QLabel(text) self.message_label.setStyleSheet("font: 12px;") self.text_and_button_Vlay.addWidget(self.message_label) self.button_and_combo = QHBoxLayout() ## Create group from button and combobox self.cluster_start_calibrate_button = QPushButton( "Start \n callibrate") self.cluster_start_calibrate_button.setFixedWidth(100) self.cluster_start_calibrate_button.setFixedHeight(60) self.button_and_combo.addWidget(self.cluster_start_calibrate_button) self.combo_lay = QVBoxLayout() self.call_H = QHBoxLayout() self.call_H.setAlignment(Qt.AlignRight) self.cluster_call_label = QLabel("Call:") self.cluster_combo_call = QComboBox() self.freq_H = QHBoxLayout() self.freq_H.setAlignment(Qt.AlignRight) self.cluster_freq_label = QLabel("Freq:") self.cluster_combo_freq = QComboBox() self.call_H.addWidget(self.cluster_call_label) self.call_H.addWidget(self.cluster_combo_call) self.freq_H.addWidget(self.cluster_freq_label) self.freq_H.addWidget(self.cluster_combo_freq) self.combo_lay.addLayout(self.call_H) self.combo_lay.addLayout(self.freq_H) self.button_and_combo.addLayout(self.combo_lay) self.text_and_button_Vlay.addLayout(self.button_and_combo) self.calibrate_lay.addLayout(self.text_and_button_Vlay) ## Create filter band self.cluster_filter_band_combo = QCheckBox("Filter BAND") self.cluster_filter_band_combo.setStyleSheet( "QCheckBox{ color:" + self.settingsDict['color'] + "; font-size: 12px;}") self.cluster_filter_band_input = QLineEdit() self.cluster_filter_band_input.setFixedWidth(80) self.cluster_filter_band_input.setFixedHeight(20) self.cluster_filter_band_input.setStyleSheet( "background-color:" + self.settingsDict['form-background'] + "; font-size: 12px") text = "Bands in m." self.message_label_band = QLabel(text) self.message_label_band.setStyleSheet("font: 12px;") self.filter_band_lay = QVBoxLayout() self.filter_band_lay.addWidget(self.cluster_filter_band_combo) self.filter_band_lay.addWidget(self.message_label_band) self.filter_band_lay.addWidget(self.cluster_filter_band_input) ## Create filter spot self.cluster_filter_spot_combo = QCheckBox("Filter SPOT") self.cluster_filter_spot_combo.setStyleSheet( "QCheckBox{ color:" + self.settingsDict['color'] + "; font-size: 12px;}") self.cluster_filter_spot_input = QLineEdit() self.cluster_filter_spot_input.setFixedWidth(80) self.cluster_filter_spot_input.setFixedHeight(20) self.cluster_filter_spot_input.setStyleSheet( "background-color:" + self.settingsDict['form-background'] + "; font-size: 12px") text = "Spot prefixes" self.message_label_spot = QLabel(text) self.message_label_spot.setStyleSheet("font: 12px;") self.filter_spot_lay = QVBoxLayout() self.filter_spot_lay.addWidget(self.cluster_filter_spot_combo) self.filter_spot_lay.addWidget(self.message_label_spot) self.filter_spot_lay.addWidget(self.cluster_filter_spot_input) ## create filter spotter self.cluster_filter_spotter_combo = QCheckBox("Filter SPOTTER") self.cluster_filter_spotter_combo.setStyleSheet( "QCheckBox{ color:" + self.settingsDict['color'] + "; font-size: 12px;}") self.cluster_filter_spotter_input = QLineEdit() self.cluster_filter_spotter_input.setFixedWidth(80) self.cluster_filter_spotter_input.setFixedHeight(20) self.cluster_filter_spotter_input.setStyleSheet( "background-color:" + self.settingsDict['form-background'] + "; font-size: 12px") text = "Spotter prefixes" self.message_label_spotter = QLabel(text) self.message_label_spotter.setStyleSheet("font: 12px;") self.filter_spotter_lay = QVBoxLayout() self.filter_spotter_lay.addWidget(self.cluster_filter_spotter_combo) self.filter_spotter_lay.addWidget(self.message_label_spotter) self.filter_spotter_lay.addWidget(self.cluster_filter_spotter_input) text = "All value separate by comma" self.filter_message_label = QLabel(text) self.filter_message_label.setStyleSheet("font: 12px;") self.filters_Hlay = QHBoxLayout() self.filters_Hlay.addLayout(self.filter_band_lay) self.filters_Hlay.addLayout(self.filter_spot_lay) self.filters_Hlay.addLayout(self.filter_spotter_lay) self.filters_lay = QVBoxLayout() self.filters_lay.addSpacing(10) self.filters_lay.setAlignment(Qt.AlignCenter) self.filters_lay.addLayout(self.filters_Hlay) self.filters_lay.addWidget(self.filter_message_label) self.filters_lay.addSpacing(10) Separador = QFrame() Separador.setFrameShape(QFrame.HLine) Separador.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding) Separador.setLineWidth(1) self.filters_lay.addWidget(Separador) ## Create List view for input string from cluster self.line_text = QLabel() self.line_text.setFixedHeight(50) # Set all layers to window self.cluster_tab.layout.addLayout(self.host_port_lay) self.cluster_tab.layout.addSpacing(10) self.cluster_tab.layout.addLayout(self.filters_lay) self.cluster_tab.layout.addLayout(self.calibrate_lay) self.cluster_tab.layout.addWidget(self.line_text) ## install lay to main tab (Cluster) self.cluster_tab.setLayout(self.cluster_tab.layout) # create TCI Tab self.tci_enable_combo_lay = QHBoxLayout() self.tci_enable_combo_lay.setAlignment(Qt.AlignCenter) self.tci_enable_combo = QCheckBox("TCI Enable") self.tci_enable_combo.setStyleSheet("QCheckBox{" + self.settingsDict['color'] + "}") self.tci_enable_combo_lay.addWidget(self.tci_enable_combo) self.tci_tab.layout = QVBoxLayout(self) self.tci_host = QLabel("TCI host:") self.tci_host_input = QLineEdit() self.tci_host_input.setFixedWidth(150) self.tci_host_input.setStyleSheet(formstyle) self.tci_port = QLabel("TCI port:") self.tci_port_input = QLineEdit() self.tci_port_input.setFixedWidth(50) self.tci_port_input.setStyleSheet(formstyle) self.host_port_lay = QHBoxLayout() # create host:port lay self.host_lay = QVBoxLayout() self.host_lay.addWidget(self.tci_host) self.host_lay.addWidget(self.tci_host_input) self.port_lay = QVBoxLayout() self.port_lay.addWidget(self.tci_port) self.port_lay.addWidget(self.tci_port_input) self.host_port_lay.addLayout(self.host_lay) self.host_port_lay.addLayout(self.port_lay) self.tci_tab.layout.addLayout(self.tci_enable_combo_lay) self.tci_tab.layout.addLayout(self.host_port_lay) self.tci_tab.layout.addSpacing(250) self.tci_tab.setLayout(self.tci_tab.layout) # Create io_tab self.io_tab_lay = QVBoxLayout() self.io_tab_lay.setAlignment(Qt.AlignCenter) self.import_button = QPushButton("Import") self.import_button.setFixedSize(100, 30) self.import_button.clicked.connect(self.import_adi) self.import_button.setStyleSheet("width: 100px;") self.export_button = QPushButton("Export") self.export_button.clicked.connect(self.export_adi) self.export_button.setFixedSize(100, 30) self.io_tab_lay.addWidget(self.import_button) self.io_tab_lay.addWidget(self.export_button) self.io_tab.setLayout(self.io_tab_lay) # Create Services tab self.service_tab = QVBoxLayout() self.service_tab.setAlignment(Qt.AlignCenter) # create elements form self.eqsl_lay = QVBoxLayout() self.eqsl_lay.setAlignment(Qt.AlignCenter) self.eqsl_activate = QHBoxLayout() self.eqsl_chekBox = QCheckBox("Auto sent eQSL after QSO") self.eqsl_chekBox.setStyleSheet( "{ color:" + self.settingsDict['color'] + "; font-size: 12px; border-color: white }") self.eqsl_activate.addWidget(self.eqsl_chekBox) #self.eqsl_activate.addWidget(QLabel("eQSL.cc")) self.eqsl_lay.addLayout(self.eqsl_activate) self.text_eqsl_small = QLabel("Automatic send eQSL after enter QSO") self.text_eqsl_small.setStyleSheet("font: 10px; font-style: italic;") self.eqsl_lay.addWidget(self.text_eqsl_small) self.eqsl_form = QVBoxLayout() self.login = QHBoxLayout() self.login.addWidget(QLabel("Login:"******"Password:"******"Color for eQSL complited: ") self.color_label_eqsl.setStyleSheet(style) self.color_button_eqsl = QPushButton() self.color_button_eqsl.setStyleSheet( "background:" + self.settingsDict['eqsl-sent-color'] + "; color:" + self.settingsDict['eqsl-sent-color']) self.color_button_eqsl.setText(self.settingsDict['eqsl-sent-color']) self.color_button_eqsl.setFixedWidth(120) self.color_button_eqsl.setFixedHeight(40) self.color_button_eqsl.clicked.connect(self.select_eqsl_color) self.color_button_layer = QHBoxLayout() self.color_button_layer.setAlignment(Qt.AlignLeft) self.color_button_layer.addWidget(self.color_label_eqsl) self.color_button_layer.addWidget(self.color_button_eqsl) self.eqsl_lay.addLayout(self.color_button_layer) self.service_tab.addLayout(self.eqsl_lay) self.service_widget.setLayout(self.service_tab) # button panel self.button_panel = QHBoxLayout() button_style = "font: 12px;" self.button_save = QPushButton("Save and Exit") self.button_save.setStyleSheet(button_style) self.button_save.clicked.connect(self.save_and_exit_button) self.button_apply = QPushButton("Apply") self.button_apply.setStyleSheet(button_style) self.button_apply.clicked.connect(self.apply_button) self.button_cancel = QPushButton("Cancel") self.button_cancel.setStyleSheet(button_style) self.button_cancel.clicked.connect(self.cancel_button) self.button_cancel.setFixedWidth(60) self.button_panel.addWidget(self.button_cancel) self.button_panel.addWidget(self.button_apply) self.button_panel.addWidget(self.button_save) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.tab) self.mainLayout.addLayout(self.button_panel) #self.mainLayout.addWidget(self.tab) self.setLayout(self.mainLayout)
def create_gui(self): try: from fbs_runtime.application_context.PyQt5 import ( ApplicationContext) appctxt = ApplicationContext() app = appctxt.app except ImportError: app = QApplication(sys.argv) app.setStyle('Fusion') self.window = QMainWindow() self.quit_shortcuts = [] for seq in ("Ctrl+Q", "Ctrl+C", "Ctrl+W", "ESC"): s = QShortcut(QKeySequence(seq), self.window) s.activated.connect(app.exit) self.quit_shortcuts.append(s) is_outdated, latest_version = check_outdated( 'mint-amazon-tagger', VERSION) if is_outdated: outdate_msg = QErrorMessage(self.window) outdate_msg.showMessage( 'A new version is available. Please update for the best ' 'experience. https://github.com/jprouty/mint-amazon-tagger') v_layout = QVBoxLayout() h_layout = QHBoxLayout() v_layout.addLayout(h_layout) amazon_group = QGroupBox('Amazon Order History') amazon_group.setMinimumWidth(300) amazon_layout = QVBoxLayout() amazon_mode = QComboBox() amazon_mode.addItem('Fetch Reports') amazon_mode.addItem('Use Local Reports') amazon_mode.setFocusPolicy(Qt.StrongFocus) has_csv = any([ self.args.orders_csv, self.args.items_csv, self.args.refunds_csv]) self.amazon_mode_layout = ( self.create_amazon_import_layout() if has_csv else self.create_amazon_fetch_layout()) amazon_mode.setCurrentIndex(1 if has_csv else 0) def on_amazon_mode_changed(i): self.clear_layout(self.amazon_mode_layout) if i == 0: self.amazon_mode_layout = self.create_amazon_fetch_layout() elif i == 1: self.amazon_mode_layout = self.create_amazon_import_layout() amazon_layout.addLayout(self.amazon_mode_layout) amazon_mode.currentIndexChanged.connect( on_amazon_mode_changed) amazon_layout.addWidget(amazon_mode) amazon_layout.addLayout(self.amazon_mode_layout) amazon_group.setLayout(amazon_layout) h_layout.addWidget(amazon_group) mint_group = QGroupBox('Mint Login && Options') mint_group.setMinimumWidth(350) mint_layout = QFormLayout() mint_layout.addRow( 'Email:', self.create_line_edit('mint_email', tool_tip=NEVER_SAVE_MSG)) mint_layout.addRow( 'Password:'******'mint_password', tool_tip=NEVER_SAVE_MSG, password=True)) mint_layout.addRow( 'MFA Code:', self.create_combobox( 'mint_mfa_method', ['SMS', 'Email'], lambda x: x.lower())) mint_layout.addRow( 'Sync first?', self.create_checkbox('mint_wait_for_sync')) mint_layout.addRow( 'Merchant Filter', self.create_line_edit('mint_input_merchant_filter')) mint_layout.addRow( 'Include MMerchant', self.create_checkbox('mint_input_include_mmerchant')) mint_layout.addRow( 'Include Merchant', self.create_checkbox('mint_input_include_merchant')) mint_layout.addRow( 'Input Categories Filter', self.create_line_edit('mint_input_categories_filter')) mint_group.setLayout(mint_layout) h_layout.addWidget(mint_group) tagger_group = QGroupBox('Tagger Options') tagger_layout = QHBoxLayout() tagger_left = QFormLayout() tagger_left.addRow( 'Verbose Itemize', self.create_checkbox('verbose_itemize')) tagger_left.addRow( 'Do not Itemize', self.create_checkbox('no_itemize')) tagger_left.addRow( 'Retag Changed', self.create_checkbox('retag_changed')) tagger_right = QFormLayout() tagger_right.addRow( 'Do not tag categories', self.create_checkbox('no_tag_categories')) tagger_right.addRow( 'Do not predict categories', self.create_checkbox('do_not_predict_categories')) tagger_right.addRow( 'Max days between payment/shipment', self.create_combobox( 'max_days_between_payment_and_shipping', ['3', '4', '5', '6', '7', '8', '9', '10'], lambda x: int(x))) tagger_layout.addLayout(tagger_left) tagger_layout.addLayout(tagger_right) tagger_group.setLayout(tagger_layout) v_layout.addWidget(tagger_group) self.start_button = QPushButton('Start Tagging') self.start_button.setAutoDefault(True) self.start_button.clicked.connect(self.on_start_button_clicked) v_layout.addWidget(self.start_button) main_widget = QWidget() main_widget.setLayout(v_layout) self.window.setCentralWidget(main_widget) self.window.show() return app.exec_()
def __init__(self, debugServer, docked, vm, parent=None, embeddedShell=True, embeddedBrowser=True): """ Constructor @param debugServer reference to the debug server object @param docked flag indicating a dock window @param vm reference to the viewmanager object @param parent parent widget (QWidget) @param embeddedShell flag indicating whether the shell should be included. This flag is set to False by those layouts, that have the interpreter shell in a separate window. @param embeddedBrowser flag indicating whether the file browser should be included. This flag is set to False by those layouts, that have the file browser in a separate window or embedded in the project browser instead. """ super(DebugViewer, self).__init__(parent) self.debugServer = debugServer self.debugUI = None self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) self.__mainLayout = QVBoxLayout() self.__mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.__mainLayout) self.__tabWidget = E5TabWidget() self.__mainLayout.addWidget(self.__tabWidget) self.embeddedShell = embeddedShell if embeddedShell: from QScintilla.Shell import ShellAssembly # add the interpreter shell self.shellAssembly = ShellAssembly(debugServer, vm, False) self.shell = self.shellAssembly.shell() index = self.__tabWidget.addTab( self.shellAssembly, UI.PixmapCache.getIcon("shell.png"), '') self.__tabWidget.setTabToolTip(index, self.shell.windowTitle()) self.embeddedBrowser = embeddedBrowser if embeddedBrowser: from UI.Browser import Browser # add the browser self.browser = Browser() index = self.__tabWidget.addTab( self.browser, UI.PixmapCache.getIcon("browser.png"), '') self.__tabWidget.setTabToolTip(index, self.browser.windowTitle()) from .VariablesViewer import VariablesViewer # add the global variables viewer self.glvWidget = QWidget() self.glvWidgetVLayout = QVBoxLayout(self.glvWidget) self.glvWidgetVLayout.setContentsMargins(0, 0, 0, 0) self.glvWidgetVLayout.setSpacing(3) self.glvWidget.setLayout(self.glvWidgetVLayout) self.globalsViewer = VariablesViewer(self.glvWidget, True) self.glvWidgetVLayout.addWidget(self.globalsViewer) self.glvWidgetHLayout = QHBoxLayout() self.glvWidgetHLayout.setContentsMargins(3, 3, 3, 3) self.globalsFilterEdit = QLineEdit(self.glvWidget) self.globalsFilterEdit.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed) self.glvWidgetHLayout.addWidget(self.globalsFilterEdit) self.globalsFilterEdit.setToolTip( self.tr("Enter regular expression patterns separated by ';'" " to define variable filters. ")) self.globalsFilterEdit.setWhatsThis( self.tr("Enter regular expression patterns separated by ';'" " to define variable filters. All variables and" " class attributes matched by one of the expressions" " are not shown in the list above.")) self.setGlobalsFilterButton = QPushButton( self.tr('Set'), self.glvWidget) self.glvWidgetHLayout.addWidget(self.setGlobalsFilterButton) self.glvWidgetVLayout.addLayout(self.glvWidgetHLayout) index = self.__tabWidget.addTab( self.glvWidget, UI.PixmapCache.getIcon("globalVariables.png"), '') self.__tabWidget.setTabToolTip(index, self.globalsViewer.windowTitle()) self.setGlobalsFilterButton.clicked.connect( self.__setGlobalsFilter) self.globalsFilterEdit.returnPressed.connect(self.__setGlobalsFilter) # add the local variables viewer self.lvWidget = QWidget() self.lvWidgetVLayout = QVBoxLayout(self.lvWidget) self.lvWidgetVLayout.setContentsMargins(0, 0, 0, 0) self.lvWidgetVLayout.setSpacing(3) self.lvWidget.setLayout(self.lvWidgetVLayout) self.lvWidgetHLayout1 = QHBoxLayout() self.lvWidgetHLayout1.setContentsMargins(3, 3, 3, 3) self.stackComboBox = QComboBox(self.lvWidget) self.stackComboBox.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed) self.lvWidgetHLayout1.addWidget(self.stackComboBox) self.sourceButton = QPushButton(self.tr('Source'), self.lvWidget) self.lvWidgetHLayout1.addWidget(self.sourceButton) self.sourceButton.setEnabled(False) self.lvWidgetVLayout.addLayout(self.lvWidgetHLayout1) self.localsViewer = VariablesViewer(self.lvWidget, False) self.lvWidgetVLayout.addWidget(self.localsViewer) self.lvWidgetHLayout2 = QHBoxLayout() self.lvWidgetHLayout2.setContentsMargins(3, 3, 3, 3) self.localsFilterEdit = QLineEdit(self.lvWidget) self.localsFilterEdit.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed) self.lvWidgetHLayout2.addWidget(self.localsFilterEdit) self.localsFilterEdit.setToolTip( self.tr( "Enter regular expression patterns separated by ';' to define " "variable filters. ")) self.localsFilterEdit.setWhatsThis( self.tr( "Enter regular expression patterns separated by ';' to define " "variable filters. All variables and class attributes matched" " by one of the expressions are not shown in the list above.")) self.setLocalsFilterButton = QPushButton( self.tr('Set'), self.lvWidget) self.lvWidgetHLayout2.addWidget(self.setLocalsFilterButton) self.lvWidgetVLayout.addLayout(self.lvWidgetHLayout2) index = self.__tabWidget.addTab( self.lvWidget, UI.PixmapCache.getIcon("localVariables.png"), '') self.__tabWidget.setTabToolTip(index, self.localsViewer.windowTitle()) self.sourceButton.clicked.connect(self.__showSource) self.stackComboBox.currentIndexChanged[int].connect( self.__frameSelected) self.setLocalsFilterButton.clicked.connect(self.__setLocalsFilter) self.localsFilterEdit.returnPressed.connect(self.__setLocalsFilter) from .CallStackViewer import CallStackViewer # add the call stack viewer self.callStackViewer = CallStackViewer(self.debugServer) index = self.__tabWidget.addTab( self.callStackViewer, UI.PixmapCache.getIcon("step.png"), "") self.__tabWidget.setTabToolTip( index, self.callStackViewer.windowTitle()) self.callStackViewer.sourceFile.connect(self.sourceFile) self.callStackViewer.frameSelected.connect( self.__callStackFrameSelected) from .CallTraceViewer import CallTraceViewer # add the call trace viewer self.callTraceViewer = CallTraceViewer(self.debugServer) index = self.__tabWidget.addTab( self.callTraceViewer, UI.PixmapCache.getIcon("callTrace.png"), "") self.__tabWidget.setTabToolTip( index, self.callTraceViewer.windowTitle()) self.callTraceViewer.sourceFile.connect(self.sourceFile) from .BreakPointViewer import BreakPointViewer # add the breakpoint viewer self.breakpointViewer = BreakPointViewer() self.breakpointViewer.setModel(self.debugServer.getBreakPointModel()) index = self.__tabWidget.addTab( self.breakpointViewer, UI.PixmapCache.getIcon("breakpoints.png"), '') self.__tabWidget.setTabToolTip( index, self.breakpointViewer.windowTitle()) self.breakpointViewer.sourceFile.connect(self.sourceFile) from .WatchPointViewer import WatchPointViewer # add the watch expression viewer self.watchpointViewer = WatchPointViewer() self.watchpointViewer.setModel(self.debugServer.getWatchPointModel()) index = self.__tabWidget.addTab( self.watchpointViewer, UI.PixmapCache.getIcon("watchpoints.png"), '') self.__tabWidget.setTabToolTip( index, self.watchpointViewer.windowTitle()) from .ExceptionLogger import ExceptionLogger # add the exception logger self.exceptionLogger = ExceptionLogger() index = self.__tabWidget.addTab( self.exceptionLogger, UI.PixmapCache.getIcon("exceptions.png"), '') self.__tabWidget.setTabToolTip( index, self.exceptionLogger.windowTitle()) if self.embeddedShell: self.__tabWidget.setCurrentWidget(self.shellAssembly) else: if self.embeddedBrowser: self.__tabWidget.setCurrentWidget(self.browser) else: self.__tabWidget.setCurrentWidget(self.glvWidget) # add the threads viewer self.__mainLayout.addWidget(QLabel(self.tr("Threads:"))) self.__threadList = QTreeWidget() self.__threadList.setHeaderLabels( [self.tr("ID"), self.tr("Name"), self.tr("State"), ""]) self.__threadList.setSortingEnabled(True) self.__mainLayout.addWidget(self.__threadList) self.__doThreadListUpdate = True self.__threadList.currentItemChanged.connect(self.__threadSelected) self.__mainLayout.setStretchFactor(self.__tabWidget, 5) self.__mainLayout.setStretchFactor(self.__threadList, 1) self.currPage = None self.currentStack = None self.framenr = 0 self.debugServer.clientStack.connect(self.handleClientStack) self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode") self.sourceButton.setVisible(not self.__autoViewSource)
def current_settings(self): self.box_data = QGroupBox("Current Values") text_data1 = QLabel("Photodiode A Max") text_data1.setFont(QFont("Times", 12, weight=QFont.Bold)) text_data1.setStyleSheet("color:#143642") self.value_data1 = QLabel("00") self.value_data1.setStyleSheet("background-color:#F1F7EE") self.value_data1.setAlignment(Qt.AlignHCenter) self.value_data1.setFont(QFont("Times", 23, weight=QFont.Bold)) text_data2 = QLabel("Photodiode A Min") text_data2.setFont(QFont("Times", 12, weight=QFont.Bold)) text_data2.setStyleSheet("color:#143642") self.value_data2 = QLabel("00") self.value_data2.setStyleSheet("background-color:#F1F7EE") self.value_data2.setAlignment(Qt.AlignHCenter) self.value_data2.setFont(QFont("Times", 23, weight=QFont.Bold)) self.box_data = QGroupBox("Current Values") text_data3 = QLabel("Photodiode B") text_data3.setFont(QFont("Times", 12, weight=QFont.Bold)) text_data3.setStyleSheet("color:#143642") self.value_data3 = QLabel("00") self.value_data3.setStyleSheet("background-color:#F1F7EE") self.value_data3.setAlignment(Qt.AlignHCenter) self.value_data3.setFont(QFont("Times", 23, weight=QFont.Bold)) text_data4 = QLabel("Calibrated B") text_data4.setFont(QFont("Times", 12, weight=QFont.Bold)) text_data4.setStyleSheet("color:#143642") self.value_data4 = QLabel("00") self.value_data4.setStyleSheet("background-color:#F1F7EE") self.value_data4.setAlignment(Qt.AlignHCenter) self.value_data4.setFont(QFont("Times", 23, weight=QFont.Bold)) b1 = QHBoxLayout() b1.addWidget(text_data1) b1.addWidget(text_data2) b2 = QHBoxLayout() b2.addWidget(self.value_data1) b2.addWidget(self.value_data2) b3 = QHBoxLayout() b3.addWidget(text_data3) b3.addWidget(text_data4) b4 = QHBoxLayout() b4.addWidget(self.value_data3) b4.addWidget(self.value_data4) # b1.setAlignment(Qt.AlignHCenter) # b1.addStretch(1) b5 = QVBoxLayout() b5.addLayout(b1) b5.addSpacing(1) b5.addLayout(b2) b5.addSpacing(10) b5.addLayout(b3) b5.addSpacing(1) b5.addLayout(b4) self.box_data.setLayout(b5) self.box_data.setStyleSheet("background-color: #87BBA2") return self.box_data
def __init__(self): super(MainWindow, self).__init__() # 菜单 self.recentFileActs = [] # 将mainwindow的中心组件设置为widget,然后在里面布局 self.setAttribute(Qt.WA_DeleteOnClose) self.widget = QWidget() self.setCentralWidget(self.widget) self.createActions() self.createMenus() self.statusBar() #主界面 self.img_label = QLabel("原始土壤图片") self.img_label.setAlignment(Qt.AlignCenter) # label 居中 self.img_label.setFont(QFont("Roman times", 12)) #, QFont.Bold self.raw_img_view = QGraphicsView() self.pro_img_label = QLabel("处理后土壤图片") self.pro_img_label.setAlignment(Qt.AlignCenter) # label 居中 self.pro_img_label.setFont(QFont("Roman times", 12)) #, QFont.Bold self.pro_img_view = QGraphicsView() self.chooseImgButton = QPushButton("选取图片") self.onlineButton = QPushButton("在线检测") self.grayHistogram_label = QLabel("分类说明") self.grayHistogram_label.setAlignment(Qt.AlignCenter) # label 居中 self.grayHistogram_label.setFont(QFont("Roman times", 12)) #, QFont.Bold self.gray_Hist_view = QTextBrowser() self.gray_Hist_view.setReadOnly(True) self.gray_Hist_view.setFont(QFont("Roman times", 12)) information = "类别 : 湿度\n" + "类别0: 0%-2.5%\n" + "类别1: 2.5%-7.5%\n" + "类别2: 7.5%-12.5%\n" + "类别3: 12.5%-17.5%\n" + "类别4: 17.5%-22.5%\n" + "类别5: 22.5%及以上\n" self.gray_Hist_view.setText(information) self.text_label = QLabel("湿度识别结果") self.text_label.setAlignment(Qt.AlignCenter) # label 居中 self.text_label.setFont(QFont("Roman times", 12)) self.result_text = QTextBrowser() self.result_text.setReadOnly(True) self.result_text.setFont(QFont("Roman times", 12)) #, QFont.Bold self.hide_button = QPushButton("") # self.hide_button.setVisible(False) # 布局 leftDown_layout = QHBoxLayout() leftDown_layout.addWidget(self.chooseImgButton) leftDown_layout.addWidget(self.onlineButton) left_layout = QVBoxLayout() left_layout.addWidget(self.img_label) left_layout.addWidget(self.raw_img_view) left_layout.addWidget(self.pro_img_label) left_layout.addWidget(self.pro_img_view) left_layout.addLayout(leftDown_layout) right_layout = QVBoxLayout() right_layout.addWidget(self.grayHistogram_label) right_layout.addWidget(self.gray_Hist_view) right_layout.addWidget(self.text_label) right_layout.addWidget(self.result_text) right_layout.addWidget(self.hide_button) mainlayout = QHBoxLayout() mainlayout.addLayout(left_layout) mainlayout.addLayout(right_layout) self.widget.setLayout(mainlayout) # self.setWindowTitle("土壤含水量在线检测上位机") self.setGeometry(250, 100, 1080, 820) # posx,posy,w,h self.chooseImgButton.clicked.connect( self.clicked_local_button) # 更新各种信息 self.onlineButton.clicked.connect(self.clicked_online_button) # 更新各种信息 self.networkset = None # 网络设置 self.ReceiceImgThread = None # 多线程
def init_ui(self, name): self.setFrameStyle(QFrame.Sunken | QFrame.StyledPanel) self.graphicsView = GraphicsView(self) self.graphicsView.setRenderHint(QPainter.Antialiasing, False) self.graphicsView.setDragMode(QGraphicsView.RubberBandDrag) self.graphicsView.setOptimizationFlags( QGraphicsView.DontSavePainterState) self.graphicsView.setViewportUpdateMode( QGraphicsView.SmartViewportUpdate) self.graphicsView.setTransformationAnchor( QGraphicsView.AnchorUnderMouse) size = self.style().pixelMetric(QStyle.PM_ToolBarIconSize) iconSize = QSize(size, size) zoomInIcon = QToolButton() zoomInIcon.setAutoRepeat(True) zoomInIcon.setAutoRepeatInterval(33) zoomInIcon.setAutoRepeatDelay(0) zoomInIcon.setIcon(QIcon(":/zoomin.png")) zoomInIcon.setIconSize(iconSize) zoomOutIcon = QToolButton() zoomOutIcon.setAutoRepeat(True) zoomOutIcon.setAutoRepeatInterval(33) zoomOutIcon.setAutoRepeatDelay(0) zoomOutIcon.setIcon(QIcon(":/zoomout.png")) zoomOutIcon.setIconSize(iconSize) self.zoomSlider = QSlider() self.zoomSlider.setMinimum(0) self.zoomSlider.setMaximum(500) self.zoomSlider.setValue(250) self.zoomSlider.setTickPosition(QSlider.TicksRight) # Zoom slider layout zoomSliderLayout = QVBoxLayout() zoomSliderLayout.addWidget(zoomInIcon) zoomSliderLayout.addWidget(self.zoomSlider) zoomSliderLayout.addWidget(zoomOutIcon) rotateLeftIcon = QToolButton() rotateLeftIcon.setIcon(QIcon(":/rotateleft.png")) rotateLeftIcon.setIconSize(iconSize) rotateRightIcon = QToolButton() rotateRightIcon.setIcon(QIcon(":/rotateright.png")) rotateRightIcon.setIconSize(iconSize) self.rotateSlider = QSlider() self.rotateSlider.setOrientation(Qt.Horizontal) self.rotateSlider.setMinimum(-360) self.rotateSlider.setMaximum(360) self.rotateSlider.setValue(0) self.rotateSlider.setTickPosition(QSlider.TicksBelow) # Rotate slider layout rotateSliderLayout = QHBoxLayout() rotateSliderLayout.addWidget(rotateLeftIcon) rotateSliderLayout.addWidget(self.rotateSlider) rotateSliderLayout.addWidget(rotateRightIcon) self.resetButton = QToolButton() self.resetButton.setText("0") self.resetButton.setEnabled(False) # Label layout labelLayout = QHBoxLayout() self.label = QLabel(name) self.label2 = QLabel("Pointer Mode") self.selectModeButton = QToolButton() self.selectModeButton.setText("Select") self.selectModeButton.setCheckable(True) self.selectModeButton.setChecked(True) self.dragModeButton = QToolButton() self.dragModeButton.setText("Drag") self.dragModeButton.setCheckable(True) self.dragModeButton.setChecked(False) self.antialiasButton = QToolButton() self.antialiasButton.setText("Antialiasing") self.antialiasButton.setCheckable(True) self.antialiasButton.setChecked(False) self.openGlButton = QToolButton() self.openGlButton.setText("OpenGL") self.openGlButton.setCheckable(True) self.openGlButton.setEnabled(QGLFormat.hasOpenGL()) pointerModeGroup = QButtonGroup() pointerModeGroup.setExclusive(True) pointerModeGroup.addButton(self.selectModeButton) pointerModeGroup.addButton(self.dragModeButton) labelLayout.addWidget(self.label) labelLayout.addStretch() labelLayout.addWidget(self.label2) labelLayout.addWidget(self.selectModeButton) labelLayout.addWidget(self.dragModeButton) labelLayout.addStretch() labelLayout.addWidget(self.antialiasButton) labelLayout.addWidget(self.openGlButton) topLayout = QGridLayout() topLayout.addLayout(labelLayout, 0, 0) topLayout.addWidget(self.graphicsView, 1, 0) topLayout.addLayout(zoomSliderLayout, 1, 1) topLayout.addLayout(rotateSliderLayout, 2, 0) topLayout.addWidget(self.resetButton, 2, 1) self.setLayout(topLayout) self.resetButton.clicked.connect(self.resetView) self.zoomSlider.valueChanged.connect(self.setupTransform) self.rotateSlider.valueChanged.connect(self.setupTransform) self.graphicsView.verticalScrollBar().valueChanged.connect( self.setResetButtonEnabled) self.graphicsView.horizontalScrollBar().valueChanged.connect( self.setResetButtonEnabled) self.selectModeButton.toggled.connect(self.togglePointerMode) self.dragModeButton.toggled.connect(self.togglePointerMode) self.antialiasButton.toggled.connect(self.toggleAntialiasing) self.openGlButton.toggled.connect(self.toggleOpenGL) rotateLeftIcon.clicked.connect(self.rotateLeft) rotateRightIcon.clicked.connect(self.rotateRight) zoomInIcon.clicked.connect(self.zoomIn) zoomOutIcon.clicked.connect(self.zoomOut) self.setupTransform()
def __init__(self, parent: 'ElectrumWindow', config: 'SimpleConfig'): WindowModalDialog.__init__(self, parent, _('Preferences')) self.config = config self.window = parent self.need_restart = False self.fx = self.window.fx self.wallet = self.window.wallet vbox = QVBoxLayout() tabs = QTabWidget() gui_widgets = [] tx_widgets = [] oa_widgets = [] # language lang_help = _( 'Select which language is used in the GUI (after restart).') lang_label = HelpLabel(_('Language') + ':', lang_help) lang_combo = QComboBox() lang_combo.addItems(list(languages.values())) lang_keys = list(languages.keys()) lang_cur_setting = self.config.get("language", '') try: index = lang_keys.index(lang_cur_setting) except ValueError: # not in list index = 0 lang_combo.setCurrentIndex(index) if not self.config.is_modifiable('language'): for w in [lang_combo, lang_label]: w.setEnabled(False) def on_lang(x): lang_request = list(languages.keys())[lang_combo.currentIndex()] if lang_request != self.config.get('language'): self.config.set_key("language", lang_request, True) self.need_restart = True lang_combo.currentIndexChanged.connect(on_lang) gui_widgets.append((lang_label, lang_combo)) nz_help = _( 'Number of zeros displayed after the decimal point. For example, if this is set to 2, "1." will be displayed as "1.00"' ) nz_label = HelpLabel(_('Zeros after decimal point') + ':', nz_help) nz = QSpinBox() nz.setMinimum(0) nz.setMaximum(self.config.decimal_point) nz.setValue(self.config.num_zeros) if not self.config.is_modifiable('num_zeros'): for w in [nz, nz_label]: w.setEnabled(False) def on_nz(): value = nz.value() if self.config.num_zeros != value: self.config.num_zeros = value self.config.set_key('num_zeros', value, True) self.window.history_list.update() self.window.address_list.update() nz.valueChanged.connect(on_nz) gui_widgets.append((nz_label, nz)) use_rbf = bool(self.config.get('use_rbf', True)) use_rbf_cb = QCheckBox(_('Use Replace-By-Fee')) use_rbf_cb.setChecked(use_rbf) use_rbf_cb.setToolTip( _('If you check this box, your transactions will be marked as non-final,') + '\n' + \ _('and you will have the possibility, while they are unconfirmed, to replace them with transactions that pay higher fees.') + '\n' + \ _('Note that some merchants do not accept non-final transactions until they are confirmed.')) def on_use_rbf(x): self.config.set_key('use_rbf', bool(x)) batch_rbf_cb.setEnabled(bool(x)) use_rbf_cb.stateChanged.connect(on_use_rbf) tx_widgets.append((use_rbf_cb, None)) batch_rbf_cb = QCheckBox(_('Batch RBF transactions')) batch_rbf_cb.setChecked(bool(self.config.get('batch_rbf', False))) batch_rbf_cb.setEnabled(use_rbf) batch_rbf_cb.setToolTip( _('If you check this box, your unconfirmed transactions will be consolidated into a single transaction.') + '\n' + \ _('This will save fees.')) def on_batch_rbf(x): self.config.set_key('batch_rbf', bool(x)) batch_rbf_cb.stateChanged.connect(on_batch_rbf) tx_widgets.append((batch_rbf_cb, None)) # lightning lightning_widgets = [] help_local_wt = _("""If this option is checked, Electrum will run a local watchtower and protect your channels even if your wallet is not open. For this to work, your computer needs to be online regularly.""") local_wt_cb = QCheckBox(_("Run a local watchtower")) local_wt_cb.setToolTip(help_local_wt) local_wt_cb.setChecked( bool(self.config.get('run_local_watchtower', False))) def on_local_wt_checked(x): self.config.set_key('run_local_watchtower', bool(x)) local_wt_cb.stateChanged.connect(on_local_wt_checked) lightning_widgets.append((local_wt_cb, None)) help_persist = _( """If this option is checked, Electrum will persist after you close all your wallet windows, and the Electrum icon will be visible in the taskbar. Use this if you want your local watchtower to keep running after you close your wallet.""" ) persist_cb = QCheckBox(_("Persist after all windows are closed")) persist_cb.setToolTip(help_persist) persist_cb.setChecked(bool(self.config.get('persist_daemon', False))) def on_persist_checked(x): self.config.set_key('persist_daemon', bool(x)) persist_cb.stateChanged.connect(on_persist_checked) lightning_widgets.append((persist_cb, None)) help_remote_wt = _( """To use a remote watchtower, enter the corresponding URL here""") remote_wt_cb = QCheckBox(_("Use a remote watchtower")) remote_wt_cb.setToolTip(help_remote_wt) remote_wt_cb.setChecked(bool(self.config.get('use_watchtower', False))) def on_remote_wt_checked(x): self.config.set_key('use_watchtower', bool(x)) self.watchtower_url_e.setEnabled(bool(x)) remote_wt_cb.stateChanged.connect(on_remote_wt_checked) watchtower_url = self.config.get('watchtower_url') self.watchtower_url_e = QLineEdit(watchtower_url) self.watchtower_url_e.setEnabled( self.config.get('use_watchtower', False)) def on_wt_url(): url = self.watchtower_url_e.text() or None watchtower_url = self.config.set_key('watchtower_url', url) self.watchtower_url_e.editingFinished.connect(on_wt_url) lightning_widgets.append((remote_wt_cb, self.watchtower_url_e)) msg = _('OpenAlias record, used to receive coins and to sign payment requests.') + '\n\n'\ + _('The following alias providers are available:') + '\n'\ + '\n'.join(['https://cryptoname.co/', 'http://xmr.link']) + '\n\n'\ + 'For more information, see https://openalias.org' alias_label = HelpLabel(_('OpenAlias') + ':', msg) alias = self.config.get('alias', '') self.alias_e = QLineEdit(alias) self.set_alias_color() self.alias_e.editingFinished.connect(self.on_alias_edit) oa_widgets.append((alias_label, self.alias_e)) # units units = base_units_list msg = (_( 'Base unit of your wallet.' ) + '\n1 LTC = 1000 mLTC. 1 mLTC = 1000 uLTC. 1 uLTC = 100 sat.\n' + _( 'This setting affects the Send tab, and all balance related fields.' )) unit_label = HelpLabel(_('Base unit') + ':', msg) unit_combo = QComboBox() unit_combo.addItems(units) unit_combo.setCurrentIndex(units.index(self.window.base_unit())) def on_unit(x, nz): unit_result = units[unit_combo.currentIndex()] if self.window.base_unit() == unit_result: return edits = self.window.amount_e, self.window.receive_amount_e amounts = [edit.get_amount() for edit in edits] self.config.set_base_unit(unit_result) nz.setMaximum(self.config.decimal_point) self.window.history_list.update() self.window.request_list.update() self.window.address_list.update() for edit, amount in zip(edits, amounts): edit.setAmount(amount) self.window.update_status() unit_combo.currentIndexChanged.connect(lambda x: on_unit(x, nz)) gui_widgets.append((unit_label, unit_combo)) system_cameras = qrscanner._find_system_cameras() qr_combo = QComboBox() qr_combo.addItem("Default", "default") for camera, device in system_cameras.items(): qr_combo.addItem(camera, device) #combo.addItem("Manually specify a device", config.get("video_device")) index = qr_combo.findData(self.config.get("video_device")) qr_combo.setCurrentIndex(index) msg = _("Install the zbar package to enable this.") qr_label = HelpLabel(_('Video Device') + ':', msg) qr_combo.setEnabled(qrscanner.libzbar is not None) on_video_device = lambda x: self.config.set_key( "video_device", qr_combo.itemData(x), True) qr_combo.currentIndexChanged.connect(on_video_device) gui_widgets.append((qr_label, qr_combo)) colortheme_combo = QComboBox() colortheme_combo.addItem(_('Light'), 'default') colortheme_combo.addItem(_('Dark'), 'dark') index = colortheme_combo.findData( self.config.get('qt_gui_color_theme', 'default')) colortheme_combo.setCurrentIndex(index) colortheme_label = QLabel(_('Color theme') + ':') def on_colortheme(x): self.config.set_key('qt_gui_color_theme', colortheme_combo.itemData(x), True) self.need_restart = True colortheme_combo.currentIndexChanged.connect(on_colortheme) gui_widgets.append((colortheme_label, colortheme_combo)) updatecheck_cb = QCheckBox( _("Automatically check for software updates")) updatecheck_cb.setChecked(bool(self.config.get('check_updates', False))) def on_set_updatecheck(v): self.config.set_key('check_updates', v == Qt.Checked, save=True) updatecheck_cb.stateChanged.connect(on_set_updatecheck) gui_widgets.append((updatecheck_cb, None)) filelogging_cb = QCheckBox(_("Write logs to file")) filelogging_cb.setChecked(bool(self.config.get('log_to_file', False))) def on_set_filelogging(v): self.config.set_key('log_to_file', v == Qt.Checked, save=True) self.need_restart = True filelogging_cb.stateChanged.connect(on_set_filelogging) filelogging_cb.setToolTip( _('Debug logs can be persisted to disk. These are useful for troubleshooting.' )) gui_widgets.append((filelogging_cb, None)) preview_cb = QCheckBox(_('Advanced preview')) preview_cb.setChecked(bool(self.config.get('advanced_preview', False))) preview_cb.setToolTip( _("Open advanced transaction preview dialog when 'Pay' is clicked." )) def on_preview(x): self.config.set_key('advanced_preview', x == Qt.Checked) preview_cb.stateChanged.connect(on_preview) tx_widgets.append((preview_cb, None)) usechange_cb = QCheckBox(_('Use change addresses')) usechange_cb.setChecked(self.window.wallet.use_change) if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False) def on_usechange(x): usechange_result = x == Qt.Checked if self.window.wallet.use_change != usechange_result: self.window.wallet.use_change = usechange_result self.window.wallet.db.put('use_change', self.window.wallet.use_change) multiple_cb.setEnabled(self.window.wallet.use_change) usechange_cb.stateChanged.connect(on_usechange) usechange_cb.setToolTip( _('Using change addresses makes it more difficult for other people to track your transactions.' )) tx_widgets.append((usechange_cb, None)) def on_multiple(x): multiple = x == Qt.Checked if self.wallet.multiple_change != multiple: self.wallet.multiple_change = multiple self.wallet.db.put('multiple_change', multiple) multiple_change = self.wallet.multiple_change multiple_cb = QCheckBox(_('Use multiple change addresses')) multiple_cb.setEnabled(self.wallet.use_change) multiple_cb.setToolTip('\n'.join([ _('In some cases, use up to 3 change addresses in order to break ' 'up large coin amounts and obfuscate the recipient address.'), _('This may result in higher transactions fees.') ])) multiple_cb.setChecked(multiple_change) multiple_cb.stateChanged.connect(on_multiple) tx_widgets.append((multiple_cb, None)) def fmt_docs(key, klass): lines = [ln.lstrip(" ") for ln in klass.__doc__.split("\n")] return '\n'.join([key, "", " ".join(lines)]) choosers = sorted(coinchooser.COIN_CHOOSERS.keys()) if len(choosers) > 1: chooser_name = coinchooser.get_name(self.config) msg = _( 'Choose coin (UTXO) selection method. The following are available:\n\n' ) msg += '\n\n'.join( fmt_docs(*item) for item in coinchooser.COIN_CHOOSERS.items()) chooser_label = HelpLabel(_('Coin selection') + ':', msg) chooser_combo = QComboBox() chooser_combo.addItems(choosers) i = choosers.index(chooser_name) if chooser_name in choosers else 0 chooser_combo.setCurrentIndex(i) def on_chooser(x): chooser_name = choosers[chooser_combo.currentIndex()] self.config.set_key('coin_chooser', chooser_name) chooser_combo.currentIndexChanged.connect(on_chooser) tx_widgets.append((chooser_label, chooser_combo)) def on_unconf(x): self.config.set_key('confirmed_only', bool(x)) conf_only = bool(self.config.get('confirmed_only', False)) unconf_cb = QCheckBox(_('Spend only confirmed coins')) unconf_cb.setToolTip(_('Spend only confirmed inputs.')) unconf_cb.setChecked(conf_only) unconf_cb.stateChanged.connect(on_unconf) tx_widgets.append((unconf_cb, None)) def on_outrounding(x): self.config.set_key('coin_chooser_output_rounding', bool(x)) enable_outrounding = bool( self.config.get('coin_chooser_output_rounding', True)) outrounding_cb = QCheckBox(_('Enable output value rounding')) outrounding_cb.setToolTip( _('Set the value of the change output so that it has similar precision to the other outputs.' ) + '\n' + _('This might improve your privacy somewhat.') + '\n' + _('If enabled, at most 100 satoshis might be lost due to this, per transaction.' )) outrounding_cb.setChecked(enable_outrounding) outrounding_cb.stateChanged.connect(on_outrounding) tx_widgets.append((outrounding_cb, None)) block_explorers = sorted(util.block_explorer_info().keys()) BLOCK_EX_CUSTOM_ITEM = _("Custom URL") if BLOCK_EX_CUSTOM_ITEM in block_explorers: # malicious translation? block_explorers.remove(BLOCK_EX_CUSTOM_ITEM) block_explorers.append(BLOCK_EX_CUSTOM_ITEM) msg = _( 'Choose which online block explorer to use for functions that open a web browser' ) block_ex_label = HelpLabel(_('Online Block Explorer') + ':', msg) block_ex_combo = QComboBox() block_ex_custom_e = QLineEdit( self.config.get('block_explorer_custom') or '') block_ex_combo.addItems(block_explorers) block_ex_combo.setCurrentIndex( block_ex_combo.findText( util.block_explorer(self.config) or BLOCK_EX_CUSTOM_ITEM)) def showhide_block_ex_custom_e(): block_ex_custom_e.setVisible( block_ex_combo.currentText() == BLOCK_EX_CUSTOM_ITEM) showhide_block_ex_custom_e() def on_be_combo(x): if block_ex_combo.currentText() == BLOCK_EX_CUSTOM_ITEM: on_be_edit() else: be_result = block_explorers[block_ex_combo.currentIndex()] self.config.set_key('block_explorer_custom', None, False) self.config.set_key('block_explorer', be_result, True) showhide_block_ex_custom_e() block_ex_combo.currentIndexChanged.connect(on_be_combo) def on_be_edit(): val = block_ex_custom_e.text() try: val = ast.literal_eval(val) # to also accept tuples except: pass self.config.set_key('block_explorer_custom', val) block_ex_custom_e.editingFinished.connect(on_be_edit) block_ex_hbox = QHBoxLayout() block_ex_hbox.setContentsMargins(0, 0, 0, 0) block_ex_hbox.setSpacing(0) block_ex_hbox.addWidget(block_ex_combo) block_ex_hbox.addWidget(block_ex_custom_e) block_ex_hbox_w = QWidget() block_ex_hbox_w.setLayout(block_ex_hbox) tx_widgets.append((block_ex_label, block_ex_hbox_w)) # Fiat Currency hist_checkbox = QCheckBox() hist_capgains_checkbox = QCheckBox() fiat_address_checkbox = QCheckBox() ccy_combo = QComboBox() ex_combo = QComboBox() def update_currencies(): if not self.window.fx: return currencies = sorted( self.fx.get_currencies(self.fx.get_history_config())) ccy_combo.clear() ccy_combo.addItems([_('None')] + currencies) if self.fx.is_enabled(): ccy_combo.setCurrentIndex( ccy_combo.findText(self.fx.get_currency())) def update_history_cb(): if not self.fx: return hist_checkbox.setChecked(self.fx.get_history_config()) hist_checkbox.setEnabled(self.fx.is_enabled()) def update_fiat_address_cb(): if not self.fx: return fiat_address_checkbox.setChecked(self.fx.get_fiat_address_config()) def update_history_capgains_cb(): if not self.fx: return hist_capgains_checkbox.setChecked( self.fx.get_history_capital_gains_config()) hist_capgains_checkbox.setEnabled(hist_checkbox.isChecked()) def update_exchanges(): if not self.fx: return b = self.fx.is_enabled() ex_combo.setEnabled(b) if b: h = self.fx.get_history_config() c = self.fx.get_currency() exchanges = self.fx.get_exchanges_by_ccy(c, h) else: exchanges = self.fx.get_exchanges_by_ccy('USD', False) ex_combo.blockSignals(True) ex_combo.clear() ex_combo.addItems(sorted(exchanges)) ex_combo.setCurrentIndex( ex_combo.findText(self.fx.config_exchange())) ex_combo.blockSignals(False) def on_currency(hh): if not self.fx: return b = bool(ccy_combo.currentIndex()) ccy = str(ccy_combo.currentText()) if b else None self.fx.set_enabled(b) if b and ccy != self.fx.ccy: self.fx.set_currency(ccy) update_history_cb() update_exchanges() self.window.update_fiat() def on_exchange(idx): exchange = str(ex_combo.currentText()) if self.fx and self.fx.is_enabled( ) and exchange and exchange != self.fx.exchange.name(): self.fx.set_exchange(exchange) def on_history(checked): if not self.fx: return self.fx.set_history_config(checked) update_exchanges() self.window.history_model.refresh('on_history') if self.fx.is_enabled() and checked: self.fx.trigger_update() update_history_capgains_cb() def on_history_capgains(checked): if not self.fx: return self.fx.set_history_capital_gains_config(checked) self.window.history_model.refresh('on_history_capgains') def on_fiat_address(checked): if not self.fx: return self.fx.set_fiat_address_config(checked) self.window.address_list.refresh_headers() self.window.address_list.update() update_currencies() update_history_cb() update_history_capgains_cb() update_fiat_address_cb() update_exchanges() ccy_combo.currentIndexChanged.connect(on_currency) hist_checkbox.stateChanged.connect(on_history) hist_capgains_checkbox.stateChanged.connect(on_history_capgains) fiat_address_checkbox.stateChanged.connect(on_fiat_address) ex_combo.currentIndexChanged.connect(on_exchange) fiat_widgets = [] fiat_widgets.append((QLabel(_('Fiat currency')), ccy_combo)) fiat_widgets.append((QLabel(_('Source')), ex_combo)) fiat_widgets.append((QLabel(_('Show history rates')), hist_checkbox)) fiat_widgets.append((QLabel(_('Show capital gains in history')), hist_capgains_checkbox)) fiat_widgets.append((QLabel(_('Show Fiat balance for addresses')), fiat_address_checkbox)) tabs_info = [ (gui_widgets, _('General')), (tx_widgets, _('Transactions')), (lightning_widgets, _('Lightning')), (fiat_widgets, _('Fiat')), (oa_widgets, _('OpenAlias')), ] for widgets, name in tabs_info: tab = QWidget() tab_vbox = QVBoxLayout(tab) grid = QGridLayout() for a, b in widgets: i = grid.rowCount() if b: if a: grid.addWidget(a, i, 0) grid.addWidget(b, i, 1) else: grid.addWidget(a, i, 0, 1, 2) tab_vbox.addLayout(grid) tab_vbox.addStretch(1) tabs.addTab(tab, name) vbox.addWidget(tabs) vbox.addStretch(1) vbox.addLayout(Buttons(CloseButton(self))) self.setLayout(vbox)
def select_storage( self, path, get_wallet_from_daemon) -> Tuple[str, Optional[WalletStorage]]: vbox = QVBoxLayout() hbox = QHBoxLayout() hbox.addWidget(QLabel(_('Wallet') + ':')) self.name_e = QLineEdit() hbox.addWidget(self.name_e) button = QPushButton(_('Choose...')) hbox.addWidget(button) vbox.addLayout(hbox) self.msg_label = QLabel('') vbox.addWidget(self.msg_label) hbox2 = QHBoxLayout() self.pw_e = QLineEdit('', self) self.pw_e.setFixedWidth(150) self.pw_e.setEchoMode(2) self.pw_label = QLabel(_('Password') + ':') hbox2.addWidget(self.pw_label) hbox2.addWidget(self.pw_e) hbox2.addStretch() vbox.addLayout(hbox2) self.set_layout(vbox, title=_('Vialectrum wallet')) self.temp_storage = WalletStorage(path, manual_upgrades=True) wallet_folder = os.path.dirname(self.temp_storage.path) def on_choose(): path, __ = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) if path: self.name_e.setText(path) def on_filename(filename): path = os.path.join(wallet_folder, filename) wallet_from_memory = get_wallet_from_daemon(path) try: if wallet_from_memory: self.temp_storage = wallet_from_memory.storage else: self.temp_storage = WalletStorage(path, manual_upgrades=True) self.next_button.setEnabled(True) except BaseException: self.logger.exception('') self.temp_storage = None self.next_button.setEnabled(False) user_needs_to_enter_password = False if self.temp_storage: if not self.temp_storage.file_exists(): msg =_("This file does not exist.") + '\n' \ + _("Press 'Next' to create this wallet, or choose another file.") elif not wallet_from_memory: if self.temp_storage.is_encrypted_with_user_pw(): msg = _("This file is encrypted with a password.") + '\n' \ + _('Enter your password or choose another file.') user_needs_to_enter_password = True elif self.temp_storage.is_encrypted_with_hw_device(): msg = _("This file is encrypted using a hardware device.") + '\n' \ + _("Press 'Next' to choose device to decrypt.") else: msg = _("Press 'Next' to open this wallet.") else: msg = _("This file is already open in memory.") + "\n" \ + _("Press 'Next' to create/focus window.") else: msg = _('Cannot read file') self.msg_label.setText(msg) if user_needs_to_enter_password: self.pw_label.show() self.pw_e.show() self.pw_e.setFocus() else: self.pw_label.hide() self.pw_e.hide() button.clicked.connect(on_choose) self.name_e.textChanged.connect(on_filename) n = os.path.basename(self.temp_storage.path) self.name_e.setText(n) while True: if self.loop.exec_() != 2: # 2 = next raise UserCancelled if self.temp_storage.file_exists( ) and not self.temp_storage.is_encrypted(): break if not self.temp_storage.file_exists(): break wallet_from_memory = get_wallet_from_daemon(self.temp_storage.path) if wallet_from_memory: raise WalletAlreadyOpenInMemory(wallet_from_memory) if self.temp_storage.file_exists( ) and self.temp_storage.is_encrypted(): if self.temp_storage.is_encrypted_with_user_pw(): password = self.pw_e.text() try: self.temp_storage.decrypt(password) break except InvalidPassword as e: self.show_message(title=_('Error'), msg=str(e)) continue except BaseException as e: self.logger.exception('') self.show_message(title=_('Error'), msg=str(e)) raise UserCancelled() elif self.temp_storage.is_encrypted_with_hw_device(): try: self.run('choose_hw_device', HWD_SETUP_DECRYPT_WALLET, storage=self.temp_storage) except InvalidPassword as e: self.show_message( title=_('Error'), msg=_( 'Failed to decrypt using this hardware device.' ) + '\n' + _('If you use a passphrase, make sure it is correct.' )) self.reset_stack() return self.select_storage(path, get_wallet_from_daemon) except BaseException as e: self.logger.exception('') self.show_message(title=_('Error'), msg=str(e)) raise UserCancelled() if self.temp_storage.is_past_initial_decryption(): break else: raise UserCancelled() else: raise Exception('Unexpected encryption version') return self.temp_storage.path, ( self.temp_storage if self.temp_storage.file_exists() else None) #
def __init__(self, base=None): super().__init__(base) # units are in pixels self.windowLeftMargin = 200 self.windowTopMargin = 0 self.windowWidth = 800 self.windowHeight = 600 self.setWindowTitle('Basic Information') # window geometries and positions on the screen self.setGeometry(self.windowLeftMargin, self.windowTopMargin, self.windowWidth, self.windowHeight) # structure of the window """rootWidget (follows vertical layout): i) prompt of window, ii) form area widget (form layout) """ # root/outermost layout of the window self.windowLayout = QVBoxLayout(self) # prompt of the window (1st element of root widget) self.prompt = QLabel('Provide the basic information of the institute.', self) # form widget for inputs (2nd element of root widget) self.formWidget = QWidget(self) self.formWidgetLayout = QFormLayout(self.formWidget) # form's input widgets self.instituteName = QLabel('Name of Institute') self.instituteNameInputField = QLineEdit() # institute name input self.instituteBranch = QLabel('Branch/Region') self.instituteBranchInputField = QLineEdit() # institute branch input # list of all major Boards in India self.boardNames = [ '-- Select --', 'Central Board of Secondary Education', 'Indian Certificate of Secondary Education/Indian School Certificate', 'State Board' ] self.affiliatedBoard = QLabel('Board affiliated to') self.affiliatedBoardInputField = QComboBox(self) self.affiliatedBoardInputField.addItems(self.boardNames) # list of education levels self.educationLevels = [ '-- Select --', 'Up to 5th class (Primary)', 'Up to 8th class', 'Up to 10th class (High School)', 'Up to 12th class (Intermediate)' ] self.instituteEducationLevel = QLabel('Education Level offers') self.instituteEducationLevelInputField = QComboBox(self) self.instituteEducationLevelInputField.addItems(self.educationLevels) # possible stream combination (must be exported from a dedicated file/DB) self.streams = [ 'Science (Physics, Chemistry, Maths) with Computers', 'Science (Physics, Chemistry, Maths) without Computers', 'Science (Physics, Chemistry, Biology) with Computers', 'Science (Physics, Chemistry, Biology) without Computers', 'Commerce' ] # container/area for containing all checkboxes of each stream combinations self.streamsInputArea = QWidget(self.formWidget) self.streamsInputAreaLayout = QVBoxLayout(self.streamsInputArea) self.streamOptions = QLabel('Streams offered') for each_stream in self.streams: self.generate_stream_options_for(each_stream) # putting input fields and labels inside form layout self.formWidgetLayout.addRow(self.instituteName, self.instituteNameInputField) self.formWidgetLayout.addRow(self.instituteBranch, self.instituteBranchInputField) self.formWidgetLayout.addRow(self.affiliatedBoard, self.affiliatedBoardInputField) self.formWidgetLayout.addRow(self.instituteEducationLevel, self.instituteEducationLevelInputField) self.formWidgetLayout.addRow(self.streamOptions, self.streamsInputArea) # horizontal line (used for separating input fields from buttons) self.horizontalLine = QFrame(self) self.horizontalLine.setFrameShape(QFrame.HLine) self.horizontalLine.setFrameShadow(QFrame.Sunken) # widget containing 3 things (warning prompt area, NEXT button and CANCEL button) self.footer = QWidget(self) self.footerLayout = QHBoxLayout(self.footer) # message or warning prompts self.warningPrompt = QLabel('') # NEXT and CANCEL buttons self.nextButton = QPushButton('Next', self.footer) self.cancelButton = QPushButton('Cancel', self.footer) # putting warning prompt, NEXT and CANCEL button altogether inside footer self.footerLayout.addStretch(1) self.footerLayout.addWidget(self.warningPrompt) self.footerLayout.addWidget(self.nextButton) self.footerLayout.addWidget(self.cancelButton) # margins for form area left_form_margin = 50 top_form_margin = 20 right_form_margin = 130 bottom_form_margin = 0 self.formWidgetLayout.setContentsMargins(left_form_margin, top_form_margin, right_form_margin, bottom_form_margin) # putting all widgets inside root widget at desired place self.windowLayout.setContentsMargins(30, 10, 30, 10) self.windowLayout.addWidget(self.prompt) self.windowLayout.addWidget(self.formWidget) self.windowLayout.addStretch(1) self.windowLayout.addWidget(self.horizontalLine) self.windowLayout.addWidget(self.footer) self.setLayout(self.windowLayout)
def __init__(self, w_args, parent=None): super(Quotes, self).__init__(parent) self.args = w_args with open("static.yml", 'r') as ymlfile: self.data = yaml.load(ymlfile) # Load quotes and authors for key in self.data['quotes']['list']: #print(key, self.data['quotes']['list'][key]) quotes_list.append([key, self.data['quotes']['list'][key]]) for key in self.data['quotes']['fake_authors']: #print(key, self.data['quotes']['list'][key]) fakeAuthorList.append(key) self.quote = QLabel("Updating") self.author = QLabel("....") self.author.setAlignment(QtCore.Qt.AlignBottom) self.quote.setWordWrap(True) self.quote.setAlignment(QtCore.Qt.AlignTop) # Add widgets to layout mainLayout = QVBoxLayout() mainLayout.setSpacing(0) mainLayout.addWidget(self.quote) mainLayout.addWidget(self.author) mainW = QWidget() mainW.setLayout(mainLayout) mainL = QHBoxLayout() mainL.setContentsMargins(0,0,0,0) mainL.addWidget(mainW) self.setLayout(mainL) mainW.setObjectName("Container") # Fake or normal mode if 'mode' in self.args: self.realAuthors=w_args['mode'] #Start updatetask as thread t = threading.Timer(1.0, self.updateQuoteTask) t.daemon = True t.start() self.setMinimumHeight(200) self.setMinimumWidth(400) #background self.setAutoFillBackground(True) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) bg = "" if 'background' in self.args: if w_args['background'] == 'transparent': self.setAttribute(QtCore.Qt.WA_TranslucentBackground) if w_args['background'][0] == '#': bg = "background-color:"+self.args['background']+";" pass mainW.setStyleSheet("QWidget#Container" "{border-style: outset;" + bg + "border-width: 1px;" "border-color: rgb(60, 60, 60);" "}") #text color ct = '' if 'color' in self.args: ct = "color: " + w_args['color'] + ";" #text-size ts = '' if 'font_size' in self.args: ts = "font-size: " + w_args['font_size'] + ";" self.setStyleSheet(ct+ts)
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle('ROB 514 2D robot arm') # Control buttons for the interface quit_button = QPushButton('Quit') quit_button.clicked.connect(app.exit) # Different do reach commands reach_gradient_button = QPushButton('Reach gradient') reach_gradient_button.clicked.connect(self.reach_gradient) reach_jacobian_button = QPushButton('Reach Jacobian') reach_jacobian_button.clicked.connect(self.reach_jacobian) reaches = QGroupBox('Reaches') reaches_layout = QVBoxLayout() reaches_layout.addWidget(reach_gradient_button) reaches_layout.addWidget(reach_jacobian_button) reaches.setLayout(reaches_layout) # The parameters of the robot arm we're simulating parameters = QGroupBox('Arm parameters') parameter_layout = QVBoxLayout() self.theta_base = SliderDisplay('Angle base', -np.pi/2, np.pi/2, 0) self.theta_elbow = SliderDisplay('Angle elbow', -np.pi/2, np.pi/2, 0) self.theta_wrist = SliderDisplay('Angle wrist', -np.pi/2, np.pi/2, 0) self.theta_fingers = SliderDisplay('Angle fingers', -np.pi/4, 0, -np.pi/8) self.length_upper_arm = SliderDisplay('Length upper arm', 0.2, 0.4, 0.3) self.length_lower_arm = SliderDisplay('Length lower arm', 0.1, 0.2, 0.15) self.length_fingers = SliderDisplay('Length fingers', 0.05, 0.1, 0.075) self.theta_slds = [] self.theta_slds.append(self.theta_base) self.theta_slds.append(self.theta_elbow) self.theta_slds.append(self.theta_wrist) parameter_layout.addWidget(self.theta_base) parameter_layout.addWidget(self.theta_elbow) parameter_layout.addWidget(self.theta_wrist) parameter_layout.addWidget(self.theta_fingers) parameter_layout.addWidget(self.length_upper_arm) parameter_layout.addWidget(self.length_lower_arm) parameter_layout.addWidget(self.length_fingers) parameters.setLayout(parameter_layout) # The point to reach to reach_point = QGroupBox('Reach point') reach_point_layout = QVBoxLayout() self.reach_x = SliderDisplay('x', 0, 1, 0.5) self.reach_y = SliderDisplay('y', 0, 1, 0.5) random_button = QPushButton('Random') random_button.clicked.connect(self.random_reach) reach_point_layout.addWidget(self.reach_x) reach_point_layout.addWidget(self.reach_y) reach_point_layout.addWidget(random_button) reach_point.setLayout(reach_point_layout) # The display for the graph self.robot_arm = DrawRobot(self) # The layout of the interface widget = QWidget() self.setCentralWidget(widget) top_level_layout = QHBoxLayout() widget.setLayout(top_level_layout) left_side_layout = QVBoxLayout() right_side_layout = QVBoxLayout() left_side_layout.addWidget(reaches) left_side_layout.addWidget(reach_point) left_side_layout.addStretch() left_side_layout.addWidget(parameters) right_side_layout.addWidget(self.robot_arm) right_side_layout.addWidget(quit_button) top_level_layout.addLayout(left_side_layout) top_level_layout.addLayout(right_side_layout) SliderDisplay.gui = self
def __init__(self, parent=None): QWidget.__init__(self, parent) self.calc = CalcCore() self.setWindowTitle('rpCalc') modPath = os.path.abspath(sys.path[0]) if modPath.endswith('.zip') or modPath.endswith('.exe'): modPath = os.path.dirname(modPath) # for py2exe/cx_freeze iconPathList = [iconPath, os.path.join(modPath, 'icons/'), os.path.join(modPath, '../icons')] self.icons = icondict.IconDict() self.icons.addIconPath(filter(None, iconPathList)) self.icons.addIconPath([path for path in iconPathList if path]) try: QApplication.setWindowIcon(self.icons['calc_lg']) except KeyError: pass self.setFocusPolicy(Qt.StrongFocus) self.helpView = None self.extraView = None self.regView = None self.histView = None self.memView = None self.altBaseView = None self.optDlg = None self.popupMenu = QMenu(self) self.popupMenu.addAction('Registers on &LCD', self.toggleReg) self.popupMenu.addSeparator() self.popupMenu.addAction('Show &Register List', self.viewReg) self.popupMenu.addAction('Show &History List', self.viewHist) self.popupMenu.addAction('Show &Memory List', self.viewMem) self.popupMenu.addSeparator() self.popupMenu.addAction('Show Other &Bases', self.viewAltBases) self.popupMenu.addSeparator() self.popupMenu.addAction('Show Help &File', self.help) self.popupMenu.addAction('&About rpCalc', self.about) self.popupMenu.addSeparator() self.popupMenu.addAction('&Quit', self.close) topLay = QVBoxLayout(self) self.setLayout(topLay) topLay.setSpacing(4) topLay.setContentsMargins(6, 6, 6, 6) lcdBox = LcdBox() topLay.addWidget(lcdBox) lcdLay = QGridLayout(lcdBox) lcdLay.setColumnStretch(1, 1) lcdLay.setRowStretch(3, 1) self.extraLabels = [QLabel(' T:',), QLabel(' Z:',), QLabel(' Y:',)] for i in range(3): lcdLay.addWidget(self.extraLabels[i], i, 0, Qt.AlignLeft) self.extraLcds = [Lcd(1.5, 13), Lcd(1.5, 13), Lcd(1.5, 13)] lcdLay.addWidget(self.extraLcds[2], 0, 1, Qt.AlignRight) lcdLay.addWidget(self.extraLcds[1], 1, 1, Qt.AlignRight) lcdLay.addWidget(self.extraLcds[0], 2, 1, Qt.AlignRight) if not self.calc.option.boolData('ViewRegisters'): for w in self.extraLabels + self.extraLcds: w.hide() self.lcd = Lcd(2.0, 13) lcdLay.addWidget(self.lcd, 3, 0, 1, 2, Qt.AlignRight) self.setLcdHighlight() self.updateLcd() self.updateColors() self.cmdLay = QGridLayout() topLay.addLayout(self.cmdLay) self.cmdDict = {} self.addCmdButton('x^2', 0, 0) self.addCmdButton('sqRT', 0, 1) self.addCmdButton('y^X', 0, 2) self.addCmdButton('xRT', 0, 3) self.addCmdButton('RCIP', 0, 4) self.addCmdButton('SIN', 1, 0) self.addCmdButton('COS', 1, 1) self.addCmdButton('TAN', 1, 2) self.addCmdButton('LN', 1, 3) self.addCmdButton('e^X', 1, 4) self.addCmdButton('ASIN', 2, 0) self.addCmdButton('ACOS', 2, 1) self.addCmdButton('ATAN', 2, 2) self.addCmdButton('LOG', 2, 3) self.addCmdButton('tn^X', 2, 4) self.addCmdButton('STO', 3, 0) self.addCmdButton('RCL', 3, 1) self.addCmdButton('R<', 3, 2) self.addCmdButton('R>', 3, 3) self.addCmdButton('x<>y', 3, 4) self.addCmdButton('SHOW', 4, 0) self.addCmdButton('CLR', 4, 1) self.addCmdButton('PLCS', 4, 2) self.addCmdButton('SCI', 4, 3) self.addCmdButton('DEG', 4, 4) self.addCmdButton('EXIT', 5, 0) self.addCmdButton('Pi', 5, 1) self.addCmdButton('EXP', 5, 2) self.addCmdButton('CHS', 5, 3) self.addCmdButton('<-', 5, 4) self.mainLay = QGridLayout() topLay.addLayout(self.mainLay) self.mainDict = {} self.addMainButton(0, 'OPT', 0, 0) self.addMainButton(Qt.Key_Slash, '/', 0, 1) self.addMainButton(Qt.Key_Asterisk, '*', 0, 2) self.addMainButton(Qt.Key_Minus, '-', 0, 3) self.addMainButton(Qt.Key_7, '7', 1, 0) self.addMainButton(Qt.Key_8, '8', 1, 1) self.addMainButton(Qt.Key_9, '9', 1, 2) self.addMainButton(Qt.Key_Plus, '+', 1, 3, 1, 0) self.addMainButton(Qt.Key_4, '4', 2, 0) self.addMainButton(Qt.Key_5, '5', 2, 1) self.addMainButton(Qt.Key_6, '6', 2, 2) self.addMainButton(Qt.Key_1, '1', 3, 0) self.addMainButton(Qt.Key_2, '2', 3, 1) self.addMainButton(Qt.Key_3, '3', 3, 2) self.addMainButton(Qt.Key_Enter, 'ENT', 3, 3, 1, 0) self.addMainButton(Qt.Key_0, '0', 4, 0, 0, 1) self.addMainButton(Qt.Key_Period, '.', 4, 2) self.mainDict[Qt.Key_Return] = \ self.mainDict[Qt.Key_Enter] # added for european keyboards: self.mainDict[Qt.Key_Comma] = \ self.mainDict[Qt.Key_Period] self.cmdDict['ENT'] = self.mainDict[Qt.Key_Enter] self.cmdDict['OPT'] = self.mainDict[0] self.entryStr = '' self.showMode = False statusBox = QFrame() statusBox.setFrameStyle(QFrame.Panel | QFrame.Sunken) statusBox.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)) topLay.addWidget(statusBox) statusLay = QHBoxLayout(statusBox) self.entryLabel = QLabel(statusBox) statusLay.addWidget(self.entryLabel) statusLay.setContentsMargins(1, 1, 1, 1) self.statusLabel = QLabel(statusBox) self.statusLabel.setAlignment(Qt.AlignRight) statusLay.addWidget(self.statusLabel) if self.calc.option.boolData('ExtraViewStartup'): self.viewReg() if self.calc.option.boolData('AltBaseStartup'): self.viewAltBases() xSize = self.calc.option.intData('MainDlgXSize', 0, 10000) ySize = self.calc.option.intData('MainDlgYSize', 0, 10000) if xSize and ySize: self.resize(xSize, ySize) self.move(self.calc.option.intData('MainDlgXPos', 0, 10000), self.calc.option.intData('MainDlgYPos', 0, 10000)) self.updateEntryLabel('rpCalc Version {0}'.format(__version__)) QTimer.singleShot(5000, self.updateEntryLabel)