def __init__(self, text, parent): super(DragLabel, self).__init__(parent) metric = QtGui.QFontMetrics(self.font()) size = metric.size(QtCore.Qt.TextSingleLine, text) image = QtGui.QImage(size.width() + 12, size.height() + 12, QtGui.QImage.Format_ARGB32_Premultiplied) image.fill(QtGui.qRgba(0, 0, 0, 0)) font = QtGui.QFont() font.setStyleStrategy(QtGui.QFont.ForceOutline) painter = QtGui.QPainter() painter.begin(image) painter.setRenderHint(QtGui.QPainter.Antialiasing) painter.setBrush(QtCore.Qt.white) painter.drawRoundedRect(QtCore.QRectF(0.5, 0.5, image.width()-1, image.height()-1), 25, 25, QtCore.Qt.RelativeSize) painter.setFont(font) painter.setBrush(QtCore.Qt.black) painter.drawText(QtCore.QRect(QtCore.QPoint(6, 6), size), QtCore.Qt.AlignCenter, text) painter.end() self.setPixmap(QtGui.QPixmap.fromImage(image)) self.labelText = text
def __init__(self, text, font, position, maxSize, alpha=0): DisplayShape.__init__(self, position, maxSize) self.alpha = alpha self.textDocument = QtGui.QTextDocument() self.textDocument.setHtml(text) self.textDocument.setDefaultFont(font) self.textDocument.setPageSize(maxSize) documentSize = self.textDocument.documentLayout().documentSize() self.setSize(QtCore.QSizeF(self.maxSize.width(), min(self.maxSize.height(), documentSize.height()))) self.source = QtGui.QImage(int(ceil(documentSize.width())), int(ceil(documentSize.height())), QtGui.QImage.Format_ARGB32_Premultiplied) self.source.fill(QtGui.qRgba(255, 255, 255, 255)) context = QtGui.QAbstractTextDocumentLayout.PaintContext() self.textDocument.documentLayout().setPaintDevice(self.source) painter = QtGui.QPainter() painter.begin(self.source) painter.setRenderHint(QtGui.QPainter.TextAntialiasing) painter.setRenderHint(QtGui.QPainter.Antialiasing) self.textDocument.documentLayout().draw(painter, context) painter.end() self.source = self.source.scaled(int(ceil(self.maxSize.width())), int(ceil(self.maxSize.height())), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) self.image = QtGui.QImage(self.source.size(), self.source.format()) self.redraw()
def rgbFromWaveLength(self, wave): r = 0.0 g = 0.0 b = 0.0 if wave >= 380.0 and wave <= 440.0: r = -1.0 * (wave - 440.0) / (440.0 - 380.0) b = 1.0 elif wave >= 440.0 and wave <= 490.0: g = (wave - 440.0) / (490.0 - 440.0) b = 1.0 elif wave >= 490.0 and wave <= 510.0: g = 1.0 b = -1.0 * (wave - 510.0) / (510.0 - 490.0) elif wave >= 510.0 and wave <= 580.0: r = (wave - 510.0) / (580.0 - 510.0) g = 1.0 elif wave >= 580.0 and wave <= 645.0: r = 1.0 g = -1.0 * (wave - 645.0) / (645.0 - 580.0) elif wave >= 645.0 and wave <= 780.0: r = 1.0 s = 1.0 if wave > 700.0: s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0) elif wave < 420.0: s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0) r = pow(r * s, 0.8) g = pow(g * s, 0.8) b = pow(b * s, 0.8) return QtGui.qRgb(int(r*255), int(g*255), int(b*255))
def redraw(self): self.image.fill(QtGui.qRgba(self.alpha, self.alpha, self.alpha, self.alpha)) painter = QtGui.QPainter() painter.begin(self.image) painter.setCompositionMode(QtGui.QPainter.CompositionMode_SourceIn) painter.drawImage(0, 0, self.source) painter.end()
def resizeImage(self, image, newSize): if image.size() == newSize: return newImage = QtGui.QImage(newSize, QtGui.QImage.Format_RGB32) newImage.fill(QtGui.qRgb(255, 255, 255)) painter = QtGui.QPainter(newImage) painter.drawImage(QtCore.QPoint(0, 0), image) self.image = newImage
def data(self, index, role): if not index.isValid() or role != QtCore.Qt.DisplayRole: return None return QtGui.qGray(self.modelImage.pixel(index.column(), index.row()))
def initialize(self): # create a MonitorModel to communicate with the QML view self.monitor_model = MonitorModel() self.monitors = self.monitor_model.monitors # create a SettingsModel to communicate with the settings drawer # in the QML view self.settings_model = SettingsModel(self) # connect the statAdded and statRemoved signals self.settings_model.statAdded.connect(self.add_stat) self.settings_model.statRemoved.connect(self.remove_stat) if self.qapp is None: self.qapp = QtWidgets.QApplication(sys.argv) # add custom fonts font_db = QtGui.QFontDatabase() font_paths = [ self.get_asset_path('Raleway-Regular.ttf'), self.get_asset_path('RobotoMono-Regular.ttf') ] for font_path in font_paths: font_id = font_db.addApplicationFont(font_path) if font_id == -1: logging.warn(f'Could not load font ({font_path})') font = QtGui.QFont('Raleway') self.qapp.setFont(font) # set favicon icon_info = [('icons/favicon-16x16.png', (16, 16)), ('icons/favicon-32x32.png', (32, 32)), ('icons/android-chrome-192x192.png', (192, 192)), ('icons/android-chrome-256x256.png', (256, 256))] app_icon = QtGui.QIcon() for path, size in icon_info: app_icon.addFile(self.get_asset_path(path), QtCore.QSize(*size)) self.qapp.setWindowIcon(app_icon) for stat in self.initial_stats: self.add_stat(stat, add_to_config=False) view = QtQuick.QQuickView() view.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView) root_context = view.rootContext() # make monitor model and settings model available in QML root_context.setContextProperty('monitorModel', self.monitor_model) root_context.setContextProperty('settingsModel', self.settings_model) # qml/view.qml is the root QML file qml_file = os.path.join(os.path.dirname(__file__), 'qml', 'view.qml') view.setSource(QtCore.QUrl.fromLocalFile(os.path.abspath(qml_file))) if view.status() == QtQuick.QQuickView.Error: sys.exit(-1) def signal_handler(signal, frame): # the app can not gracefully quit # when there is a keyboard interrupt # because the QAbstractListModel catches all errors # in a part of its code print() os._exit(0) signal.signal(signal.SIGINT, signal_handler) view.show() self.qapp.exec_() self.quit()
def __init__(self, file_path=None): super().__init__() PyNotepad.windows.append(self) self.file_path = file_path self.resize(800, 600) icon = QtGui.QIcon('icon.png') self.setWindowIcon(icon) app_id = 'PyNotepad.1.0.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id) self.text_edit_widget = QtWidgets.QPlainTextEdit() self.setCentralWidget(self.text_edit_widget) self.menubar = self.menuBar() self.file_menu = QtWidgets.QMenu('File', self) self.new_action = QtWidgets.QAction('New', self) self.new_action.setShortcut('Ctrl+N') self.new_action.triggered.connect(self.new) self.file_menu.addAction(self.new_action) self.new_window_action = QtWidgets.QAction('New Window', self) self.new_window_action.setShortcut('Ctrl+Shift+N') self.new_window_action.triggered.connect(PyNotepad.new_window) self.file_menu.addAction(self.new_window_action) self.open_action = QtWidgets.QAction('Open', self) self.open_action.setShortcut('Ctrl+O') self.open_action.triggered.connect(self.open) self.file_menu.addAction(self.open_action) self.file_menu.addSeparator() self.print_action = QtWidgets.QAction('Print', self) self.print_action.setShortcut('Ctrl+P') self.print_action.triggered.connect(self.print) self.file_menu.addAction(self.print_action) self.save_action = QtWidgets.QAction('Save', self) self.save_action.setShortcut('Ctrl+S') self.save_action.triggered.connect(self.save) self.file_menu.addAction(self.save_action) self.save_as_action = QtWidgets.QAction('Save As...', self) self.save_as_action.setShortcut('Ctrl+Shift+S') self.save_as_action.triggered.connect(self.save_as) self.file_menu.addAction(self.save_as_action) self.file_menu.addSeparator() self.close_action = QtWidgets.QAction('Close', self) self.close_action.triggered.connect(self.close) self.file_menu.addAction(self.close_action) self.close_all_action = QtWidgets.QAction('Close All', self) self.close_all_action.triggered.connect(PyNotepad.close_all) self.file_menu.addAction(self.close_all_action) self.menubar.addMenu(self.file_menu) self.edit_menu = QtWidgets.QMenu('Edit', self) self.undo_action = QtWidgets.QAction('Undo', self) self.undo_action.setShortcut('Ctrl+Z') self.undo_action.triggered.connect(self.text_edit_widget.undo) self.edit_menu.addAction(self.undo_action) self.redo_action = QtWidgets.QAction('Redo', self) self.redo_action.setShortcut('Ctrl+Y') self.redo_action.triggered.connect(self.text_edit_widget.redo) self.edit_menu.addAction(self.redo_action) self.edit_menu.addSeparator() self.cut_action = QtWidgets.QAction('Cut', self) self.cut_action.setShortcut('Ctrl+X') self.cut_action.triggered.connect(self.text_edit_widget.cut) self.edit_menu.addAction(self.cut_action) self.copy_action = QtWidgets.QAction('Copy', self) self.copy_action.setShortcut('Ctrl+C') self.copy_action.triggered.connect(self.text_edit_widget.copy) self.edit_menu.addAction(self.copy_action) self.paste_action = QtWidgets.QAction('Paste', self) self.paste_action.setShortcut('Ctrl+V') self.paste_action.triggered.connect(self.text_edit_widget.paste) self.edit_menu.addAction(self.paste_action) self.delete_action = QtWidgets.QAction('Delete', self) self.delete_action.setShortcut('Del') self.delete_action.triggered.connect(self.delete) self.edit_menu.addAction(self.delete_action) self.edit_menu.addSeparator() self.search_with_google_action = QtWidgets.QAction( 'Search with Google', self) self.search_with_google_action.setShortcut('Ctrl+E') self.search_with_google_action.triggered.connect( self.search_with_google) self.edit_menu.addAction(self.search_with_google_action) self.edit_menu.addSeparator() self.select_all_action = QtWidgets.QAction('Select All', self) self.select_all_action.setShortcut('Ctrl+A') self.select_all_action.triggered.connect( self.text_edit_widget.selectAll) self.edit_menu.addAction(self.select_all_action) self.time_date_action = QtWidgets.QAction('Time/Date', self) self.time_date_action.setShortcut('F5') self.time_date_action.triggered.connect(self.time_date) self.edit_menu.addAction(self.time_date_action) self.clear_action = QtWidgets.QAction('Clear', self) self.clear_action.triggered.connect(self.text_edit_widget.clear) self.edit_menu.addAction(self.clear_action) self.menubar.addMenu(self.edit_menu) self.format_menu = QtWidgets.QMenu('Format', self) self.font_action = QtWidgets.QAction('Font', self) self.font_action.triggered.connect(self._font) self.format_menu.addAction(self.font_action) self.highlight_syntax_action = QtWidgets.QAction( 'Python Syntax Highlighter', self, checkable=True) self.highlight_syntax_action.triggered.connect(self.highlight_syntax) self.format_menu.addAction(self.highlight_syntax_action) self.menubar.addMenu(self.format_menu) help_menu = QtWidgets.QMenu('Help', self) about_action = QtWidgets.QAction('About', self) about_action.triggered.connect(self.about) help_menu.addAction(about_action) self.menubar.addMenu(help_menu) self.text_edit_widget.textChanged.connect(self.text_changed) self.text_changed() self.text_edit_widget.selectionChanged.connect(self.selection_changed) self.selection_changed() self.text_edit_widget.cursorPositionChanged.connect( self.cursor_position_changed) self.cursor_position_changed() self.text_edit_widget.undoAvailable.connect( self.undo_action.setEnabled) self.undo_action.setEnabled(False) self.text_edit_widget.redoAvailable.connect( self.redo_action.setEnabled) self.redo_action.setEnabled(False) if file_path: file = open(file_path, encoding='utf-8') file_content = file.read() self.text_edit_widget.setPlainText(file_content)
def paint(self, painter, option, index): data = index.model().data(index, QtCore.Qt.DisplayRole) pgn, is_white, color, info, indicadorInicial, li_nags, agrisar, siLine = data if li_nags: li = [] st = set() for x in li_nags: x = str(x) if x in st: continue st.add(x) if x in dicNG: li.append(dicNG[x]) li_nags = li iniPZ = None finPZ = None if self.si_figurines_pgn and pgn: if pgn[0] in "QBKRN": iniPZ = pgn[0] if is_white else pgn[0].lower() pgn = pgn[1:] elif pgn[-1] in "QBRN": finPZ = pgn[-1] if is_white else pgn[-1].lower() pgn = pgn[:-1] if info and not finPZ: pgn += info info = None rect = option.rect width = rect.width() height = rect.height() x0 = rect.x() y0 = rect.y() if option.state & QtWidgets.QStyle.State_Selected: painter.fillRect(rect, QtGui.QColor(Code.configuration.pgn_selbackground( ))) # sino no se ve en CDE-Motif-Windows elif self.siFondo: fondo = index.model().getFondo(index) if fondo: painter.fillRect(rect, fondo) if agrisar: painter.setOpacity(0.18) if indicadorInicial: painter.save() painter.translate(x0, y0) painter.drawPixmap(0, 0, dicPM[indicadorInicial]) painter.restore() documentPGN = QtGui.QTextDocument() documentPGN.setDefaultFont(option.font) if color: pgn = '<font color="%s"><b>%s</b></font>' % (color, pgn) documentPGN.setHtml(pgn) wPGN = documentPGN.idealWidth() hPGN = documentPGN.size().height() hx = hPGN * 80 / 100 wpz = int(hx * 0.8) if info: documentINFO = QtGui.QTextDocument() documentINFO.setDefaultFont(option.font) if color: info = '<font color="%s"><b>%s</b></font>' % (color, info) documentINFO.setHtml(info) wINFO = documentINFO.idealWidth() ancho = wPGN if iniPZ: ancho += wpz if finPZ: ancho += wpz if info: ancho += wINFO if li_nags: ancho += wpz * len(li_nags) x = x0 + (width - ancho) / 2 if self.siAlineacion: alineacion = index.model().getAlineacion(index) if alineacion == "i": x = x0 + 3 elif alineacion == "d": x = x0 + (width - ancho - 3) y = y0 + (height - hPGN * 0.9) / 2 if iniPZ: painter.save() painter.translate(x, y) pm = dicPZ[iniPZ] pmRect = QtCore.QRectF(0, 0, hx, hx) pm.render(painter, pmRect) painter.restore() x += wpz painter.save() painter.translate(x, y) documentPGN.drawContents(painter) painter.restore() x += wPGN if finPZ: painter.save() painter.translate(x - 0.3 * wpz, y) pm = dicPZ[finPZ] pmRect = QtCore.QRectF(0, 0, hx, hx) pm.render(painter, pmRect) painter.restore() x += wpz if info: painter.save() painter.translate(x, y) documentINFO.drawContents(painter) painter.restore() x += wINFO if li_nags: for rndr in li_nags: painter.save() painter.translate(x - 0.2 * wpz, y) pmRect = QtCore.QRectF(0, 0, hx, hx) rndr.render(painter, pmRect) painter.restore() x += wpz if agrisar: painter.setOpacity(1.0) if self.siLineas: if not is_white: pen = QtGui.QPen() pen.setWidth(1) painter.setPen(pen) painter.drawLine(x0, y0 + height - 1, x0 + width, y0 + height - 1) if siLine: pen = QtGui.QPen() pen.setWidth(1) painter.setPen(pen) painter.drawLine(x0 + width - 2, y0, x0 + width - 2, y0 + height)
def download(self, version, variation): """Download routines.""" global dir_ url = "https://builder.blender.org/download/" + version if version == installedversion: reply = QtWidgets.QMessageBox.question( self, "Warning", "This version is already installed. Do you still want to continue?", QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.No, ) logger.info("Duplicated version detected") if reply == QtWidgets.QMessageBox.No: logger.debug("Skipping download of existing version") return else: pass else: pass if os.path.isdir("./blendertemp"): shutil.rmtree("./blendertemp") os.makedirs("./blendertemp") file = urllib.request.urlopen(url) totalsize = file.info()["Content-Length"] size_readable = self.hbytes(float(totalsize)) global config config.read("config.ini") config.set("main", "path", dir_) config.set("main", "flavor", variation) config.set("main", "installed", version) with open("config.ini", "w") as f: config.write(f) f.close() """Do the actual download""" dir_ = os.path.join(dir_, "") filename = "./blendertemp/" + version for i in btn: btn[i].hide() logger.info(f"Starting download thread for {url}{version}") self.lbl_available.hide() self.lbl_caution.hide() self.progressBar.show() self.btngrp_filter.hide() self.lbl_task.setText("Downloading") self.lbl_task.show() self.frm_progress.show() nowpixmap = QtGui.QPixmap( ":/newPrefix/images/Actions-arrow-right-icon.png") self.lbl_download_pic.setPixmap(nowpixmap) self.lbl_downloading.setText(f"<b>Downloading {version}</b>") self.progressBar.setValue(0) self.btn_Check.setDisabled(True) self.statusbar.showMessage(f"Downloading {size_readable}") thread = WorkerThread(url, filename) thread.update.connect(self.updatepb) thread.finishedDL.connect(self.extraction) thread.finishedEX.connect(self.finalcopy) thread.finishedCP.connect(self.cleanup) thread.finishedCL.connect(self.done) thread.start()
def __init__(self, common): super(SettingsDialog, self).__init__() self.common = common self.common.log("SettingsDialog", "__init__") self.setModal(True) self.setWindowTitle(strings._("gui_settings_window_title")) self.setWindowIcon( QtGui.QIcon(GuiCommon.get_resource_path("images/logo.png"))) self.system = platform.system() # If ONIONSHARE_HIDE_TOR_SETTINGS=1, hide Tor settings in the dialog self.hide_tor_settings = os.environ.get( "ONIONSHARE_HIDE_TOR_SETTINGS") == "1" # Automatic updates options # Autoupdate self.autoupdate_checkbox = QtWidgets.QCheckBox() self.autoupdate_checkbox.setCheckState(QtCore.Qt.Unchecked) self.autoupdate_checkbox.setText( strings._("gui_settings_autoupdate_option")) # Last update time self.autoupdate_timestamp = QtWidgets.QLabel() # Check for updates button self.check_for_updates_button = QtWidgets.QPushButton( strings._("gui_settings_autoupdate_check_button")) self.check_for_updates_button.clicked.connect(self.check_for_updates) # We can't check for updates if not connected to Tor if not self.common.gui.onion.connected_to_tor: self.check_for_updates_button.setEnabled(False) # Autoupdate options layout autoupdate_group_layout = QtWidgets.QVBoxLayout() autoupdate_group_layout.addWidget(self.autoupdate_checkbox) autoupdate_group_layout.addWidget(self.autoupdate_timestamp) autoupdate_group_layout.addWidget(self.check_for_updates_button) autoupdate_group = QtWidgets.QGroupBox( strings._("gui_settings_autoupdate_label")) autoupdate_group.setLayout(autoupdate_group_layout) # Autoupdate is only available for Windows and Mac (Linux updates using package manager) if self.system != "Windows" and self.system != "Darwin": autoupdate_group.hide() # Language settings language_label = QtWidgets.QLabel( strings._("gui_settings_language_label")) self.language_combobox = QtWidgets.QComboBox() # Populate the dropdown with all of OnionShare's available languages language_names_to_locales = { v: k for k, v in self.common.settings.available_locales.items() } language_names = list(language_names_to_locales) language_names.sort() for language_name in language_names: locale = language_names_to_locales[language_name] self.language_combobox.addItem(language_name, locale) language_layout = QtWidgets.QHBoxLayout() language_layout.addWidget(language_label) language_layout.addWidget(self.language_combobox) language_layout.addStretch() # Connection type: either automatic, control port, or socket file # Bundled Tor self.connection_type_bundled_radio = QtWidgets.QRadioButton( strings._("gui_settings_connection_type_bundled_option")) self.connection_type_bundled_radio.toggled.connect( self.connection_type_bundled_toggled) # Bundled Tor doesn't work on dev mode in Windows or Mac if (self.system == "Windows" or self.system == "Darwin") and getattr( sys, "onionshare_dev_mode", False): self.connection_type_bundled_radio.setEnabled(False) # Bridge options for bundled tor # No bridges option radio self.tor_bridges_no_bridges_radio = QtWidgets.QRadioButton( strings._("gui_settings_tor_bridges_no_bridges_radio_option")) self.tor_bridges_no_bridges_radio.toggled.connect( self.tor_bridges_no_bridges_radio_toggled) # obfs4 option radio # if the obfs4proxy binary is missing, we can't use obfs4 transports ( self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path, ) = self.common.gui.get_tor_paths() if not self.obfs4proxy_file_path or not os.path.isfile( self.obfs4proxy_file_path): self.tor_bridges_use_obfs4_radio = QtWidgets.QRadioButton( strings. _("gui_settings_tor_bridges_obfs4_radio_option_no_obfs4proxy")) self.tor_bridges_use_obfs4_radio.setEnabled(False) else: self.tor_bridges_use_obfs4_radio = QtWidgets.QRadioButton( strings._("gui_settings_tor_bridges_obfs4_radio_option")) self.tor_bridges_use_obfs4_radio.toggled.connect( self.tor_bridges_use_obfs4_radio_toggled) # meek_lite-azure option radio # if the obfs4proxy binary is missing, we can't use meek_lite-azure transports ( self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path, ) = self.common.gui.get_tor_paths() if not self.obfs4proxy_file_path or not os.path.isfile( self.obfs4proxy_file_path): self.tor_bridges_use_meek_lite_azure_radio = QtWidgets.QRadioButton( strings. _("gui_settings_tor_bridges_meek_lite_azure_radio_option_no_obfs4proxy" )) self.tor_bridges_use_meek_lite_azure_radio.setEnabled(False) else: self.tor_bridges_use_meek_lite_azure_radio = QtWidgets.QRadioButton( strings._( "gui_settings_tor_bridges_meek_lite_azure_radio_option")) self.tor_bridges_use_meek_lite_azure_radio.toggled.connect( self.tor_bridges_use_meek_lite_azure_radio_toggled) # Custom bridges radio and textbox self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton( strings._("gui_settings_tor_bridges_custom_radio_option")) self.tor_bridges_use_custom_radio.toggled.connect( self.tor_bridges_use_custom_radio_toggled) self.tor_bridges_use_custom_label = QtWidgets.QLabel( strings._("gui_settings_tor_bridges_custom_label")) self.tor_bridges_use_custom_label.setTextInteractionFlags( QtCore.Qt.TextBrowserInteraction) self.tor_bridges_use_custom_label.setOpenExternalLinks(True) self.tor_bridges_use_custom_textbox = QtWidgets.QPlainTextEdit() self.tor_bridges_use_custom_textbox.setMaximumHeight(200) self.tor_bridges_use_custom_textbox.setPlaceholderText( "[address:port] [identifier]") tor_bridges_use_custom_textbox_options_layout = QtWidgets.QVBoxLayout() tor_bridges_use_custom_textbox_options_layout.addWidget( self.tor_bridges_use_custom_label) tor_bridges_use_custom_textbox_options_layout.addWidget( self.tor_bridges_use_custom_textbox) self.tor_bridges_use_custom_textbox_options = QtWidgets.QWidget() self.tor_bridges_use_custom_textbox_options.setLayout( tor_bridges_use_custom_textbox_options_layout) self.tor_bridges_use_custom_textbox_options.hide() # Bridges layout/widget bridges_layout = QtWidgets.QVBoxLayout() bridges_layout.addWidget(self.tor_bridges_no_bridges_radio) bridges_layout.addWidget(self.tor_bridges_use_obfs4_radio) bridges_layout.addWidget(self.tor_bridges_use_meek_lite_azure_radio) bridges_layout.addWidget(self.tor_bridges_use_custom_radio) bridges_layout.addWidget(self.tor_bridges_use_custom_textbox_options) self.bridges = QtWidgets.QWidget() self.bridges.setLayout(bridges_layout) # Automatic self.connection_type_automatic_radio = QtWidgets.QRadioButton( strings._("gui_settings_connection_type_automatic_option")) self.connection_type_automatic_radio.toggled.connect( self.connection_type_automatic_toggled) # Control port self.connection_type_control_port_radio = QtWidgets.QRadioButton( strings._("gui_settings_connection_type_control_port_option")) self.connection_type_control_port_radio.toggled.connect( self.connection_type_control_port_toggled) connection_type_control_port_extras_label = QtWidgets.QLabel( strings._("gui_settings_control_port_label")) self.connection_type_control_port_extras_address = QtWidgets.QLineEdit( ) self.connection_type_control_port_extras_port = QtWidgets.QLineEdit() connection_type_control_port_extras_layout = QtWidgets.QHBoxLayout() connection_type_control_port_extras_layout.addWidget( connection_type_control_port_extras_label) connection_type_control_port_extras_layout.addWidget( self.connection_type_control_port_extras_address) connection_type_control_port_extras_layout.addWidget( self.connection_type_control_port_extras_port) self.connection_type_control_port_extras = QtWidgets.QWidget() self.connection_type_control_port_extras.setLayout( connection_type_control_port_extras_layout) self.connection_type_control_port_extras.hide() # Socket file self.connection_type_socket_file_radio = QtWidgets.QRadioButton( strings._("gui_settings_connection_type_socket_file_option")) self.connection_type_socket_file_radio.toggled.connect( self.connection_type_socket_file_toggled) connection_type_socket_file_extras_label = QtWidgets.QLabel( strings._("gui_settings_socket_file_label")) self.connection_type_socket_file_extras_path = QtWidgets.QLineEdit() connection_type_socket_file_extras_layout = QtWidgets.QHBoxLayout() connection_type_socket_file_extras_layout.addWidget( connection_type_socket_file_extras_label) connection_type_socket_file_extras_layout.addWidget( self.connection_type_socket_file_extras_path) self.connection_type_socket_file_extras = QtWidgets.QWidget() self.connection_type_socket_file_extras.setLayout( connection_type_socket_file_extras_layout) self.connection_type_socket_file_extras.hide() # Tor SOCKS address and port gui_settings_socks_label = QtWidgets.QLabel( strings._("gui_settings_socks_label")) self.connection_type_socks_address = QtWidgets.QLineEdit() self.connection_type_socks_port = QtWidgets.QLineEdit() connection_type_socks_layout = QtWidgets.QHBoxLayout() connection_type_socks_layout.addWidget(gui_settings_socks_label) connection_type_socks_layout.addWidget( self.connection_type_socks_address) connection_type_socks_layout.addWidget(self.connection_type_socks_port) self.connection_type_socks = QtWidgets.QWidget() self.connection_type_socks.setLayout(connection_type_socks_layout) self.connection_type_socks.hide() # Authentication options # No authentication self.authenticate_no_auth_radio = QtWidgets.QRadioButton( strings._("gui_settings_authenticate_no_auth_option")) self.authenticate_no_auth_radio.toggled.connect( self.authenticate_no_auth_toggled) # Password self.authenticate_password_radio = QtWidgets.QRadioButton( strings._("gui_settings_authenticate_password_option")) self.authenticate_password_radio.toggled.connect( self.authenticate_password_toggled) authenticate_password_extras_label = QtWidgets.QLabel( strings._("gui_settings_password_label")) self.authenticate_password_extras_password = QtWidgets.QLineEdit("") authenticate_password_extras_layout = QtWidgets.QHBoxLayout() authenticate_password_extras_layout.addWidget( authenticate_password_extras_label) authenticate_password_extras_layout.addWidget( self.authenticate_password_extras_password) self.authenticate_password_extras = QtWidgets.QWidget() self.authenticate_password_extras.setLayout( authenticate_password_extras_layout) self.authenticate_password_extras.hide() # Authentication options layout authenticate_group_layout = QtWidgets.QVBoxLayout() authenticate_group_layout.addWidget(self.authenticate_no_auth_radio) authenticate_group_layout.addWidget(self.authenticate_password_radio) authenticate_group_layout.addWidget(self.authenticate_password_extras) self.authenticate_group = QtWidgets.QGroupBox( strings._("gui_settings_authenticate_label")) self.authenticate_group.setLayout(authenticate_group_layout) # Put the radios into their own group so they are exclusive connection_type_radio_group_layout = QtWidgets.QVBoxLayout() connection_type_radio_group_layout.addWidget( self.connection_type_bundled_radio) connection_type_radio_group_layout.addWidget( self.connection_type_automatic_radio) connection_type_radio_group_layout.addWidget( self.connection_type_control_port_radio) connection_type_radio_group_layout.addWidget( self.connection_type_socket_file_radio) connection_type_radio_group = QtWidgets.QGroupBox( strings._("gui_settings_connection_type_label")) connection_type_radio_group.setLayout( connection_type_radio_group_layout) # The Bridges options are not exclusive (enabling Bridges offers obfs4 or custom bridges) connection_type_bridges_radio_group_layout = QtWidgets.QVBoxLayout() connection_type_bridges_radio_group_layout.addWidget(self.bridges) self.connection_type_bridges_radio_group = QtWidgets.QGroupBox( strings._("gui_settings_tor_bridges")) self.connection_type_bridges_radio_group.setLayout( connection_type_bridges_radio_group_layout) self.connection_type_bridges_radio_group.hide() # Test tor settings button self.connection_type_test_button = QtWidgets.QPushButton( strings._("gui_settings_connection_type_test_button")) self.connection_type_test_button.clicked.connect(self.test_tor_clicked) connection_type_test_button_layout = QtWidgets.QHBoxLayout() connection_type_test_button_layout.addWidget( self.connection_type_test_button) connection_type_test_button_layout.addStretch() # Connection type layout connection_type_layout = QtWidgets.QVBoxLayout() connection_type_layout.addWidget( self.connection_type_control_port_extras) connection_type_layout.addWidget( self.connection_type_socket_file_extras) connection_type_layout.addWidget(self.connection_type_socks) connection_type_layout.addWidget(self.authenticate_group) connection_type_layout.addWidget( self.connection_type_bridges_radio_group) connection_type_layout.addLayout(connection_type_test_button_layout) # Buttons self.save_button = QtWidgets.QPushButton( strings._("gui_settings_button_save")) self.save_button.clicked.connect(self.save_clicked) self.cancel_button = QtWidgets.QPushButton( strings._("gui_settings_button_cancel")) self.cancel_button.clicked.connect(self.cancel_clicked) version_label = QtWidgets.QLabel(f"OnionShare {self.common.version}") version_label.setStyleSheet(self.common.gui.css["settings_version"]) self.help_button = QtWidgets.QPushButton( strings._("gui_settings_button_help")) self.help_button.clicked.connect(self.help_clicked) buttons_layout = QtWidgets.QHBoxLayout() buttons_layout.addWidget(version_label) buttons_layout.addWidget(self.help_button) buttons_layout.addStretch() buttons_layout.addWidget(self.save_button) buttons_layout.addWidget(self.cancel_button) # Tor network connection status self.tor_status = QtWidgets.QLabel() self.tor_status.setStyleSheet( self.common.gui.css["settings_tor_status"]) self.tor_status.hide() # Layout tor_layout = QtWidgets.QVBoxLayout() tor_layout.addWidget(connection_type_radio_group) tor_layout.addLayout(connection_type_layout) tor_layout.addWidget(self.tor_status) tor_layout.addStretch() layout = QtWidgets.QVBoxLayout() if not self.hide_tor_settings: layout.addLayout(tor_layout) layout.addSpacing(20) layout.addWidget(autoupdate_group) if autoupdate_group.isVisible(): layout.addSpacing(20) layout.addLayout(language_layout) layout.addSpacing(20) layout.addStretch() layout.addLayout(buttons_layout) self.setLayout(layout) self.cancel_button.setFocus() self.reload_settings()
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) quit = QtWidgets.QPushButton("&Quit") quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold)) self.connect(quit, QtCore.SIGNAL("clicked()"), qApp, QtCore.SLOT("quit()")) angle = LCDRange("ANGLE") angle.setRange(5, 70) force = LCDRange("FORCE") force.setRange(10, 50) cannonBox = QtWidgets.QFrame() cannonBox.setFrameStyle(QtWidgets.QFrame.WinPanel | QtWidgets.QFrame.Sunken) self.cannonField = CannonField() self.connect(angle, QtCore.SIGNAL("valueChanged(int)"), self.cannonField.setAngle) self.connect(self.cannonField, QtCore.SIGNAL("angleChanged(int)"), angle.setValue) self.connect(force, QtCore.SIGNAL("valueChanged(int)"), self.cannonField.setForce) self.connect(self.cannonField, QtCore.SIGNAL("forceChanged(int)"), force.setValue) self.connect(self.cannonField, QtCore.SIGNAL("hit()"), self.hit) self.connect(self.cannonField, QtCore.SIGNAL("missed()"), self.missed) shoot = QtWidgets.QPushButton("&Shoot") shoot.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold)) self.connect(shoot, QtCore.SIGNAL("clicked()"), self.fire) self.connect(self.cannonField, QtCore.SIGNAL("canShoot(bool)"), shoot, QtCore.SLOT("setEnabled(bool)")) restart = QtWidgets.QPushButton("&New Game") restart.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold)) self.connect(restart, QtCore.SIGNAL("clicked()"), self.newGame) self.hits = QtWidgets.QLCDNumber(2) self.shotsLeft = QtWidgets.QLCDNumber(2) hitsLabel = QtWidgets.QLabel("HITS") shotsLeftLabel = QtWidgets.QLabel("SHOTS LEFT") QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Enter), self, self.fire) QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), self, self.fire) QtWidgets.QShortcut( QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Q), self, QtCore.SLOT("close()")) topLayout = QtWidgets.QHBoxLayout() topLayout.addWidget(shoot) topLayout.addWidget(self.hits) topLayout.addWidget(hitsLabel) topLayout.addWidget(self.shotsLeft) topLayout.addWidget(shotsLeftLabel) topLayout.addStretch(1) topLayout.addWidget(restart) leftLayout = QtWidgets.QVBoxLayout() leftLayout.addWidget(angle) leftLayout.addWidget(force) cannonLayout = QtWidgets.QVBoxLayout() cannonLayout.addWidget(self.cannonField) cannonBox.setLayout(cannonLayout) gridLayout = QtWidgets.QGridLayout() gridLayout.addWidget(quit, 0, 0) gridLayout.addLayout(topLayout, 0, 1) gridLayout.addLayout(leftLayout, 1, 0) gridLayout.addWidget(cannonBox, 1, 1, 2, 1) gridLayout.setColumnStretch(1, 10) self.setLayout(gridLayout) angle.setValue(60) force.setValue(25) angle.setFocus() self.newGame()
def contextMenuEvent(self, event): menu = QtGui.QMenu(self) menu.addAction(self.cutAct) menu.addAction(self.copyAct) menu.addAction(self.pasteAct) menu.exec_(event.globalPos())
def createActions(self): self.newAct = QtGui.QAction("&New", self, shortcut=QtGui.QKeySequence.New, statusTip="Create a new file", triggered=self.newFile) self.openAct = QtGui.QAction("&Open...", self, shortcut=QtGui.QKeySequence.Open, statusTip="Open an existing file", triggered=self.open) self.saveAct = QtGui.QAction("&Save", self, shortcut=QtGui.QKeySequence.Save, statusTip="Save the document to disk", triggered=self.save) self.printAct = QtGui.QAction("&Print...", self, shortcut=QtGui.QKeySequence.Print, statusTip="Print the document", triggered=self.print_) self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", statusTip="Exit the application", triggered=self.close) self.undoAct = QtGui.QAction("&Undo", self, shortcut=QtGui.QKeySequence.Undo, statusTip="Undo the last operation", triggered=self.undo) self.redoAct = QtGui.QAction("&Redo", self, shortcut=QtGui.QKeySequence.Redo, statusTip="Redo the last operation", triggered=self.redo) self.cutAct = QtGui.QAction("Cu&t", self, shortcut=QtGui.QKeySequence.Cut, statusTip="Cut the current selection's contents to the clipboard", triggered=self.cut) self.copyAct = QtGui.QAction("&Copy", self, shortcut=QtGui.QKeySequence.Copy, statusTip="Copy the current selection's contents to the clipboard", triggered=self.copy) self.pasteAct = QtGui.QAction("&Paste", self, shortcut=QtGui.QKeySequence.Paste, statusTip="Paste the clipboard's contents into the current selection", triggered=self.paste) self.boldAct = QtGui.QAction("&Bold", self, checkable=True, shortcut="Ctrl+B", statusTip="Make the text bold", triggered=self.bold) boldFont = self.boldAct.font() boldFont.setBold(True) self.boldAct.setFont(boldFont) self.italicAct = QtGui.QAction("&Italic", self, checkable=True, shortcut="Ctrl+I", statusTip="Make the text italic", triggered=self.italic) italicFont = self.italicAct.font() italicFont.setItalic(True) self.italicAct.setFont(italicFont) self.setLineSpacingAct = QtGui.QAction("Set &Line Spacing...", self, statusTip="Change the gap between the lines of a paragraph", triggered=self.setLineSpacing) self.setParagraphSpacingAct = QtGui.QAction( "Set &Paragraph Spacing...", self, statusTip="Change the gap between paragraphs", triggered=self.setParagraphSpacing) self.aboutAct = QtGui.QAction("&About", self, statusTip="Show the application's About box", triggered=self.about) self.aboutQtAct = QtGui.QAction("About &Qt", self, statusTip="Show the Qt library's About box", triggered=self.aboutQt) self.aboutQtAct.triggered.connect(QtGui.qApp.aboutQt) self.leftAlignAct = QtGui.QAction("&Left Align", self, checkable=True, shortcut="Ctrl+L", statusTip="Left align the selected text", triggered=self.leftAlign) self.rightAlignAct = QtGui.QAction("&Right Align", self, checkable=True, shortcut="Ctrl+R", statusTip="Right align the selected text", triggered=self.rightAlign) self.justifyAct = QtGui.QAction("&Justify", self, checkable=True, shortcut="Ctrl+J", statusTip="Justify the selected text", triggered=self.justify) self.centerAct = QtGui.QAction("&Center", self, checkable=True, shortcut="Ctrl+C", statusTip="Center the selected text", triggered=self.center) self.alignmentGroup = QtGui.QActionGroup(self) self.alignmentGroup.addAction(self.leftAlignAct) self.alignmentGroup.addAction(self.rightAlignAct) self.alignmentGroup.addAction(self.justifyAct) self.alignmentGroup.addAction(self.centerAct) self.leftAlignAct.setChecked(True)
if __debug__: raise (e) while exit_code == 1: exit_code = 0 try: try: app = QtWidgets.QApplication(sys.argv) except RuntimeError: # occurs on restart app = QtWidgets.QApplication.instance() app.setQuitOnLastWindowClosed(False) w = QtWidgets.QWidget() signal = WorkerSignals() tray_icon = SystemTrayIcon(icon=QtGui.QIcon("assets/icon.ico"), parent=w, signal=signal) tray_icon.show() if not os.path.exists('images'): os.makedirs('images') if not os.path.exists("images/default_wallpaper.jpg"): Wallpaper.set_default() check_file("settings.ini", "services.ini", "assets/icon.ico", "assets/missing_art.jpg", quit_if_missing=True) check_file("assets/settings_icon.png", quit_if_missing=False)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(357, 170) MainWindow.setMinimumSize(QtCore.QSize(357, 170)) MainWindow.setMaximumSize(QtCore.QSize(357, 170)) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(":/newPrefix/cool-icon-32218-Windows.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.splitter = QtWidgets.QSplitter(self.centralwidget) self.splitter.setGeometry(QtCore.QRect(50, 60, 251, 21)) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.label = QtWidgets.QLabel(self.splitter) self.label.setMaximumSize(QtCore.QSize(57, 16777215)) self.label.setStyleSheet("font: 10pt \"Segoe UI\";") self.label.setObjectName("label") self.folderName = QtWidgets.QLineEdit(self.splitter) self.folderName.setClearButtonEnabled(False) self.folderName.setObjectName("folderName") self.openFolder = QtWidgets.QToolButton(self.splitter) self.openFolder.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.openFolder.setObjectName("openFolder") self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(40, 10, 311, 31)) font = QtGui.QFont() font.setFamily("Palatino Linotype") font.setPointSize(14) font.setWeight(9) font.setItalic(False) font.setBold(False) self.label_2.setFont(font) self.label_2.setStyleSheet("\n" "font: 75 14pt \"Palatino Linotype\";") self.label_2.setObjectName("label_2") self.splitter_2 = QtWidgets.QSplitter(self.centralwidget) self.splitter_2.setGeometry(QtCore.QRect(110, 90, 191, 28)) self.splitter_2.setOrientation(QtCore.Qt.Horizontal) self.splitter_2.setObjectName("splitter_2") self.okButton = QtWidgets.QPushButton(self.splitter_2) self.okButton.setEnabled(False) self.okButton.setMinimumSize(QtCore.QSize(92, 28)) self.okButton.setMaximumSize(QtCore.QSize(92, 28)) self.okButton.setObjectName("okButton") self.CancelButton = QtWidgets.QPushButton(self.splitter_2) self.CancelButton.setMinimumSize(QtCore.QSize(93, 28)) self.CancelButton.setMaximumSize(QtCore.QSize(93, 28)) self.CancelButton.setObjectName("CancelButton") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 357, 26)) self.menubar.setObjectName("menubar") self.menuAbout = QtWidgets.QMenu(self.menubar) self.menuAbout.setObjectName("menuAbout") MainWindow.setMenuBar(self.menubar) self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.menuAbout.addAction(self.actionAbout) self.menubar.addAction(self.menuAbout.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(846, 411) MainWindow.setMinimumSize(QtCore.QSize(0, 0)) MainWindow.setMaximumSize(QtCore.QSize(16777215, 521)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(24) MainWindow.setFont(font) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("../../git/pyside1/256jpconverter.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) MainWindow.setWindowOpacity(1.0) MainWindow.setStyleSheet("background-color:#B0BEC5;") self.central_widget = QtWidgets.QWidget(MainWindow) self.central_widget.setMinimumSize(QtCore.QSize(800, 380)) self.central_widget.setMaximumSize(QtCore.QSize(16777215, 600)) font = QtGui.QFont() font.setFamily("Arial") self.central_widget.setFont(font) self.central_widget.setAutoFillBackground(False) self.central_widget.setStyleSheet("background-color: #818489;") self.central_widget.setObjectName("central_widget") self.button_convert = QtWidgets.QPushButton(self.central_widget) self.button_convert.setGeometry(QtCore.QRect(730, 190, 105, 51)) self.button_convert.setStyleSheet( "color:white;background-color:#1565c0;font:arial;font-size:17px;font-weight:bold;" ) self.button_convert.setObjectName("button_convert") self.input1 = QtWidgets.QLineEdit(self.central_widget) self.input1.setGeometry(QtCore.QRect(385, 190, 291, 51)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.input1.sizePolicy().hasHeightForWidth()) self.input1.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setPointSize(-1) self.input1.setFont(font) self.input1.setStyleSheet("background-color:#eeeeee;font-size:20px;") self.input1.setInputMask("") self.input1.setMaxLength(20) self.input1.setObjectName("input1") self.button_from_metric = QtWidgets.QPushButton(self.central_widget) self.button_from_metric.setGeometry(QtCore.QRect(385, 5, 105, 60)) self.button_from_metric.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_from_metric.setFont(font) self.button_from_metric.setStyleSheet( "color:white;background-color:#00600f;font:arial;font-size:17px;font-weight:bold;" ) self.button_from_metric.setCheckable(False) self.button_from_metric.setAutoDefault(False) self.button_from_metric.setFlat(False) self.button_from_metric.setObjectName("button_from_metric") self.button_from_jpmeasure = QtWidgets.QPushButton(self.central_widget) self.button_from_jpmeasure.setGeometry(QtCore.QRect(500, 5, 105, 60)) self.button_from_jpmeasure.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_from_jpmeasure.setFont(font) self.button_from_jpmeasure.setStyleSheet( "color:white;background-color:#00600f;font:arial;font-size:17px;font-weight:bold;" ) self.button_from_jpmeasure.setFlat(False) self.button_from_jpmeasure.setObjectName("button_from_jpmeasure") self.button_to_jpyear = QtWidgets.QPushButton(self.central_widget) self.button_to_jpyear.setGeometry(QtCore.QRect(615, 75, 105, 60)) self.button_to_jpyear.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_to_jpyear.setFont(font) self.button_to_jpyear.setStyleSheet( "color:white;background-color:#087f23;font:arial;font-size:17px;font-weight:bold;" ) self.button_to_jpyear.setFlat(False) self.button_to_jpyear.setObjectName("button_to_jpyear") self.button_exit = QtWidgets.QPushButton(self.central_widget) self.button_exit.setGeometry(QtCore.QRect(730, 290, 105, 50)) self.button_exit.setMinimumSize(QtCore.QSize(100, 40)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_exit.setFont(font) self.button_exit.setFocusPolicy(QtCore.Qt.NoFocus) self.button_exit.setStyleSheet( "color:#ffffff;background-color:#515151;font:arial;font-size:17px;font-weight:bold;" ) self.button_exit.setFlat(False) self.button_exit.setObjectName("button_exit") self.button_to_jpmeasure = QtWidgets.QPushButton(self.central_widget) self.button_to_jpmeasure.setGeometry(QtCore.QRect(500, 75, 105, 60)) self.button_to_jpmeasure.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_to_jpmeasure.setFont(font) self.button_to_jpmeasure.setStyleSheet( "color:white;background-color:#087f23;font:arial;font-size:17px;font-weight:bold;" ) self.button_to_jpmeasure.setFlat(False) self.button_to_jpmeasure.setObjectName("button_to_jpmeasure") self.button_zodiac = QtWidgets.QPushButton(self.central_widget) self.button_zodiac.setGeometry(QtCore.QRect(730, 5, 105, 60)) self.button_zodiac.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_zodiac.setFont(font) self.button_zodiac.setStyleSheet( "color:white;background-color:#00600f;font:arial;font-size:17px;font-weight:bold;" ) self.button_zodiac.setFlat(False) self.button_zodiac.setObjectName("button_zodiac") self.button_from_jpyear = QtWidgets.QPushButton(self.central_widget) self.button_from_jpyear.setGeometry(QtCore.QRect(615, 5, 105, 60)) self.button_from_jpyear.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_from_jpyear.setFont(font) self.button_from_jpyear.setStyleSheet( "color:white;background-color:#00600f;font:arial;font-size:17px;font-weight:bold;" ) self.button_from_jpyear.setObjectName("button_from_jpyear") self.label_instructions1 = QtWidgets.QLabel(self.central_widget) self.label_instructions1.setGeometry(QtCore.QRect(385, 140, 391, 46)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(50) font.setItalic(False) font.setBold(False) self.label_instructions1.setFont(font) self.label_instructions1.setStyleSheet( "font:arial; font-size:20px; color:#ffffff; padding:11px 0px 11px 0px;" ) self.label_instructions1.setObjectName("label_instructions1") self.label_output2 = QtWidgets.QTextEdit(self.central_widget) self.label_output2.setGeometry(QtCore.QRect(385, 260, 341, 91)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(18) font.setWeight(50) font.setBold(False) self.label_output2.setFont(font) self.label_output2.setStyleSheet("color:#ffffff;") self.label_output2.setFrameShape(QtWidgets.QFrame.NoFrame) self.label_output2.setFrameShadow(QtWidgets.QFrame.Plain) self.label_output2.setLineWidth(0) self.label_output2.setReadOnly(True) self.label_output2.setObjectName("label_output2") self.conv_layout = QtWidgets.QScrollArea(self.central_widget) self.conv_layout.setGeometry(QtCore.QRect(10, 70, 261, 310)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(12) self.conv_layout.setFont(font) self.conv_layout.setFrameShape(QtWidgets.QFrame.NoFrame) self.conv_layout.setFrameShadow(QtWidgets.QFrame.Plain) self.conv_layout.setLineWidth(0) self.conv_layout.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAsNeeded) self.conv_layout.setWidgetResizable(True) self.conv_layout.setObjectName("conv_layout") self.conv_layout_contents = QtWidgets.QWidget() self.conv_layout_contents.setGeometry(QtCore.QRect(0, 0, 261, 310)) self.conv_layout_contents.setObjectName("conv_layout_contents") self.conv_layout.setWidget(self.conv_layout_contents) self.button_to_metric = QtWidgets.QPushButton(self.central_widget) self.button_to_metric.setGeometry(QtCore.QRect(385, 75, 105, 60)) self.button_to_metric.setMinimumSize(QtCore.QSize(100, 60)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.button_to_metric.setFont(font) self.button_to_metric.setAutoFillBackground(False) self.button_to_metric.setStyleSheet( "color:white;background-color:#087f23;font:arial;font-size:17px;font-weight:bold;" ) self.button_to_metric.setFlat(False) self.button_to_metric.setObjectName("button_to_metric") self.label_header1 = QtWidgets.QLabel(self.central_widget) self.label_header1.setGeometry(QtCore.QRect(5, 5, 365, 61)) font = QtGui.QFont() font.setFamily("Franklin Gothic Medium") self.label_header1.setFont(font) self.label_header1.setFrameShape(QtWidgets.QFrame.NoFrame) self.label_header1.setFrameShadow(QtWidgets.QFrame.Plain) self.label_header1.setLineWidth(0) self.label_header1.setTextFormat(QtCore.Qt.AutoText) self.label_header1.setObjectName("label_header1") self.label_instructions2 = QtWidgets.QLabel(self.central_widget) self.label_instructions2.setGeometry(QtCore.QRect(10, 70, 261, 310)) font = QtGui.QFont() font.setPointSize(-1) font.setWeight(75) font.setItalic(False) font.setBold(True) self.label_instructions2.setFont(font) self.label_instructions2.setStyleSheet( "font:arial; font-size:16px; color:#ffffff; padding:11px 0px 11px 11px; line-height:1.4; font-weight: bold;" ) self.label_instructions2.setTextFormat(QtCore.Qt.RichText) self.label_instructions2.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.label_instructions2.setWordWrap(True) self.label_instructions2.setObjectName("label_instructions2") MainWindow.setCentralWidget(self.central_widget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 846, 21)) self.menubar.setStyleSheet("background-color: #ffffff;") self.menubar.setObjectName("menubar") self.menu_File = QtWidgets.QMenu(self.menubar) self.menu_File.setObjectName("menu_File") self.menu_Measures = QtWidgets.QMenu(self.menubar) self.menu_Measures.setObjectName("menu_Measures") self.menu_Years = QtWidgets.QMenu(self.menubar) self.menu_Years.setObjectName("menu_Years") MainWindow.setMenuBar(self.menubar) self.action_exit = QtWidgets.QAction(MainWindow) self.action_exit.setObjectName("action_exit") self.action_from_jpyear = QtWidgets.QAction(MainWindow) self.action_from_jpyear.setObjectName("action_from_jpyear") self.action_to_jpyear = QtWidgets.QAction(MainWindow) self.action_to_jpyear.setObjectName("action_to_jpyear") self.action_zodiac = QtWidgets.QAction(MainWindow) self.action_zodiac.setObjectName("action_zodiac") self.action_from_metric = QtWidgets.QAction(MainWindow) self.action_from_metric.setObjectName("action_from_metric") self.action_to_metric = QtWidgets.QAction(MainWindow) self.action_to_metric.setObjectName("action_to_metric") self.action_from_jpmeasure = QtWidgets.QAction(MainWindow) self.action_from_jpmeasure.setObjectName("action_from_jpmeasure") self.action_to_jpmeasure = QtWidgets.QAction(MainWindow) self.action_to_jpmeasure.setObjectName("action_to_jpmeasure") self.action_from_jpyear_historic = QtWidgets.QAction(MainWindow) self.action_from_jpyear_historic.setObjectName( "action_from_jpyear_historic") self.menu_File.addAction(self.action_exit) self.menu_Measures.addAction(self.action_from_metric) self.menu_Measures.addAction(self.action_to_metric) self.menu_Measures.addSeparator() self.menu_Measures.addAction(self.action_from_jpmeasure) self.menu_Measures.addAction(self.action_to_jpmeasure) self.menu_Years.addAction(self.action_from_jpyear) self.menu_Years.addAction(self.action_from_jpyear_historic) self.menu_Years.addAction(self.action_to_jpyear) self.menu_Years.addSeparator() self.menu_Years.addAction(self.action_zodiac) self.menubar.addAction(self.menu_File.menuAction()) self.menubar.addAction(self.menu_Measures.menuAction()) self.menubar.addAction(self.menu_Years.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.button_from_metric, self.button_from_jpmeasure) MainWindow.setTabOrder(self.button_from_jpmeasure, self.button_from_jpyear) MainWindow.setTabOrder(self.button_from_jpyear, self.button_zodiac) MainWindow.setTabOrder(self.button_zodiac, self.button_to_metric) MainWindow.setTabOrder(self.button_to_metric, self.button_to_jpmeasure) MainWindow.setTabOrder(self.button_to_jpmeasure, self.button_to_jpyear) MainWindow.setTabOrder(self.button_to_jpyear, self.input1) MainWindow.setTabOrder(self.input1, self.button_convert) MainWindow.setTabOrder(self.button_convert, self.button_exit) MainWindow.setTabOrder(self.button_exit, self.label_output2) MainWindow.setTabOrder(self.label_output2, self.conv_layout)
def createLabel(self, text): label = QtGui.QLabel(text) label.setAlignment(QtCore.Qt.AlignCenter) label.setMargin(2) label.setFrameStyle(QtGui.QFrame.Box | QtGui.QFrame.Sunken) return label
def _build(self, margin=5): """ Create a node reprensenting a box. Parameters ---------- margin: int (optional, default 5) the default margin. """ # Create a title for the node self.title = QtGui.QGraphicsTextItem(self.get_title(), self) font = self.title.font() font.setWeight(QtGui.QFont.Bold) self.title.setFont(font) self.title.setPos(margin, margin) self.title.setZValue(2) self.title.setParentItem(self) # Define the default control position control_position = ( margin + margin + self.title.boundingRect().size().height()) # Create the input controls for input_name in self.inputs: # Create the control representation control_glyph, control_text = self._create_control( input_name, control_position, is_output=False, margin=margin) # Update the class parameters self.input_controls[input_name] = (control_glyph, control_text) # Update the next control position control_position += control_text.boundingRect().size().height() # Create the output controls for output_name in self.outputs: # Create the control representation control_glyph, control_text = self._create_control( output_name, control_position, is_output=True, margin=margin) # Update the class parameters self.output_controls[output_name] = (control_glyph, control_text) # Update the next control position control_position += control_text.boundingRect().size().height() # Define the box node self.box = QtGui.QGraphicsRectItem(self) self.box.setBrush(self.background_brush) self.box.setPen(QtGui.QPen(QtCore.Qt.NoPen)) self.box.setZValue(-1) self.box.setParentItem(self) self.box.setRect(self.contentsRect()) self.box_title = QtGui.QGraphicsRectItem(self) rect = self.title.mapRectToParent(self.title.boundingRect()) brect = self.contentsRect() brect.setWidth(brect.right() - margin) rect.setWidth(brect.width()) self.box_title.setRect(rect) self.box_title.setBrush(self.title_brush) self.box_title.setPen(QtGui.QPen(QtCore.Qt.NoPen)) self.box_title.setParentItem(self)
def img_unchecked(self): return QtGui.QIcon(self.get_resource("images/unchecked.png"))
def get_icon(icon_name): path_to_icon = etc.BASEDIR / 'icons/{}.png'.format(icon_name) return QtGui.QIcon(str(path_to_icon))
def upload_pdf_icon(self): return QtGui.QIcon(self.get_resource("pdf-book.png"))
def getRundown(self, silent=False): rtext = "" self.rundownCount = 0 for _condi, _pkdf in self.pk_extracted_by_condi.items(): _Np = len(_pkdf.index) _NROI = len(_pkdf.columns) ten_percent = int(_Np / 10) rtext += "{} condition, 10% of peaks count is {} peaks\n".format( _condi, ten_percent) # look at first 5 peaks _firsttenpc = _pkdf.iloc[0:ten_percent].describe().loc["mean"] # look at last 5 peaks _lasttenpc = _pkdf.iloc[-1 - ten_percent:-1].describe().loc["mean"] _tdf = self.tracedata[_condi] _max = _tdf.max() _SD = _tdf.std() _bestSNR = _max / _SD _startSNR = _firsttenpc / _SD _endSNR = _lasttenpc / _SD #print ("ff, lf : {} {}".format(_firstfive, _lastfive)) _rundownRatio = _lasttenpc.div(_firsttenpc).sort_values() self.rundownCount += _rundownRatio[ _rundownRatio < self.rundownThreshold].count() _rd_SNR = pd.concat([_rundownRatio, _bestSNR, _startSNR, _endSNR], axis=1) _rd_SNR.columns = [ 'Rundown', 'Best SNR', 'Initial SNR', 'Final SNR' ] rtext += "Rundown (amplitude ratio: last 10% / first 10%) and signal to noise ratio (start, end)\nfor {} ROIs (ROIs with worst rundown first):\n{}\n\n".format( _NROI, _rd_SNR.round(2).to_string()) rtext += "Total number of traces with rundown worse than threshold ({}): {}\n".format( self.rundownThreshold, self.rundownCount) print(rtext) if not silent: ###Make a pop up window of these results qmb = QDialog() qmb.setWindowTitle('Rundown {}'.format(self.name)) qmb.setGeometry(800, 600, 600, 600) self.rundownText = QtGui.QTextEdit() font = QtGui.QFont() font.setFamily('Courier') font.setFixedPitch(True) font.setPointSize(12) self.rundownText.setCurrentFont(font) self.rundownText.setText(rtext) self.rundownText.setReadOnly(True) #add buttons, make it the right size qmb.layout = QVBoxLayout() qmb.layout.addWidget(self.rundownText) qmb.setLayout(qmb.layout) qmb.exec_()
import sys import math app = QtWidgets.QApplication(sys.argv) QtCore.qsrand(QtCore.QTime(0, 0, 0).secsTo(QtCore.QTime.currentTime())) scene = QtWidgets.QGraphicsScene(-200, -200, 400, 400) for i in range(10): item = ColorItem() angle = i * 6.28 / 10.0 item.setPos(math.sin(angle) * 150, math.cos(angle) * 150) scene.addItem(item) robot = Robot() robot.setTransform(QtGui.QTransform().scale(1.2, 1.2)) robot.setPos(0, -20) scene.addItem(robot) view = QtWidgets.QGraphicsView(scene) view.setRenderHint(QtGui.QPainter.Antialiasing) view.setViewportUpdateMode( QtWidgets.QGraphicsView.BoundingRectViewportUpdate) view.setBackgroundBrush(QtGui.QColor(230, 200, 167)) view.setWindowTitle("Drag and Drop Robot") view.show() sys.exit(app.exec_())
def check(self): global dir_ global lastversion global installedversion dir_ = self.line_path.text() self.frm_start.hide() self.frm_progress.hide() self.btn_oneclick.hide() self.lbl_quick.hide() self.btn_newVersion.hide() self.progressBar.hide() self.lbl_task.hide() self.btn_newVersion.hide() self.btn_execute.hide() appleicon = QtGui.QIcon(":/newPrefix/images/Apple-icon.png") windowsicon = QtGui.QIcon(":/newPrefix/images/Windows-icon.png") linuxicon = QtGui.QIcon(":/newPrefix/images/Linux-icon.png") url = "https://builder.blender.org/download/" # Do path settings save here, in case user has manually edited it global config config.read("config.ini") config.set("main", "path", dir_) with open("config.ini", "w") as f: config.write(f) f.close() try: req = requests.get(url) except Exception: self.statusBar().showMessage( "Error reaching server - check your internet connection") logger.error("No connection to Blender nightly builds server") self.frm_start.show() soup = BeautifulSoup(req.text, "html.parser") # iterate through the found versions results = [] for ul in soup.find("div", { "class": "page-footer-main-text" }).find_all("ul"): for li in ul.find_all("li", class_="os"): info = list() info.append(li.find( "a", href=True)["href"]) # Download URL to build info.append(li.find("span", class_="size").text) # Build file size info.append(li.find("small").text) # Build date results.append(info) results = [[ item.strip().strip("\xa0") if item is not None else None for item in sublist ] for sublist in results] # Removes spaces finallist = [] for sub in results: sub = list(filter(None, sub)) sub[0] = sub[0][ 10:] # Remove redundant parts of the URL (download...) finallist.append(sub) finallist = list(filter(None, finallist)) def filterall(): # Generate buttons for downloadable versions. global btn opsys = platform.system() logger.info(f"Operating system: {opsys}") for i in btn: btn[i].hide() i = 0 btn = {} for index, text in enumerate(finallist): btn[index] = QtWidgets.QPushButton(self) logger.debug(text[0] + " | " + text[1] + " | " + text[2]) if "macOS" in text[0]: # set icon according to OS if opsys.lower == "darwin": btn[index].setStyleSheet("background: rgb(22, 52, 73)") btn[index].setIcon(appleicon) elif "linux" in text[0]: if opsys == "Linux": btn[index].setStyleSheet("background: rgb(22, 52, 73)") btn[index].setIcon(linuxicon) elif "win" in text[0]: if opsys == "Windows": btn[index].setStyleSheet("background: rgb(22, 52, 73)") btn[index].setIcon(windowsicon) version = str(text[0]) variation = str(text[0]) buttontext = str(text[0]) + " | " + str(text[1]) + " | " + str( text[2]) btn[index].setIconSize(QtCore.QSize(24, 24)) btn[index].setText(buttontext) btn[index].setFixedWidth(686) btn[index].move(6, 50 + i) i += 32 btn[index].clicked.connect(lambda throwaway=0, version=version: self.download(version, variation)) btn[index].show() def filterosx(): global btn for i in btn: btn[i].hide() btn = {} i = 0 for index, text in enumerate(finallist): btn[index] = QtWidgets.QPushButton(self) if "macOS" in text[0]: btn[index].setIcon(appleicon) version = str(text[0]) variation = str(text[0]) buttontext = (str(text[0]) + " | " + str(text[1]) + " | " + str(text[2])) btn[index].setIconSize(QtCore.QSize(24, 24)) btn[index].setText(buttontext) btn[index].setFixedWidth(686) btn[index].move(6, 50 + i) i += 32 btn[index].clicked.connect( lambda throwaway=0, version=version: self.download( version, variation)) btn[index].show() def filterlinux(): global btn for i in btn: btn[i].hide() btn = {} i = 0 for index, text in enumerate(finallist): btn[index] = QtWidgets.QPushButton(self) if "linux" in text[0]: btn[index].setIcon(linuxicon) version = str(text[0]) variation = str(text[0]) buttontext = (str(text[0]) + " | " + str(text[1]) + " | " + str(text[2])) btn[index].setIconSize(QtCore.QSize(24, 24)) btn[index].setText(buttontext) btn[index].setFixedWidth(686) btn[index].move(6, 50 + i) i += 32 btn[index].clicked.connect( lambda throwaway=0, version=version: self.download( version, variation)) btn[index].show() def filterwindows(): global btn for i in btn: btn[i].hide() btn = {} i = 0 for index, text in enumerate(finallist): btn[index] = QtWidgets.QPushButton(self) if "win" in text[0]: btn[index].setIcon(windowsicon) version = str(text[0]) variation = str(text[0]) buttontext = (str(text[0]) + " | " + str(text[1]) + " | " + str(text[2])) btn[index].setIconSize(QtCore.QSize(24, 24)) btn[index].setText(" " + buttontext) btn[index].setFixedWidth(686) btn[index].move(6, 50 + i) i += 32 btn[index].clicked.connect( lambda throwaway=0, version=version: self.download( version, variation)) btn[index].show() self.lbl_available.show() self.lbl_caution.show() self.btngrp_filter.show() self.btn_osx.clicked.connect(filterosx) self.btn_linux.clicked.connect(filterlinux) self.btn_windows.clicked.connect(filterwindows) self.btn_allos.clicked.connect(filterall) lastcheck = datetime.now().strftime("%a %b %d %H:%M:%S %Y") self.statusbar.showMessage(f"Ready - Last check: {str(lastcheck)}") config.read("config.ini") config.set("main", "lastcheck", str(lastcheck)) with open("config.ini", "w") as f: config.write(f) f.close() filterall()
def create_view(self, parent_layout): self.eyetracking_title.setFont( QtGui.QFont("Times", 16, QtGui.QFont.Bold)) parent_layout.addWidget(self.eyetracking_title) parent_layout.addWidget(self.eyetracking_overlay)
def paint(self, painter, option, index): data = index.model().data(index, QtCore.Qt.DisplayRole) if type(data) == tuple: pgn, color, info, indicadorInicial, li_nags = data if li_nags: li = [] st = set() for x in li_nags: x = str(x) if x in st: continue st.add(x) if x in dicNG: li.append(dicNG[x]) li_nags = li else: pgn, color, info, indicadorInicial, li_nags = data, None, None, None, None iniPZ = None finPZ = None salto_finPZ = 0 if self.si_figurines_pgn and len(pgn) > 2: if pgn[0] in "QBKRN": iniPZ = pgn[0] if self.is_white else pgn[0].lower() pgn = pgn[1:] elif pgn[-1] in "QBRN": finPZ = pgn[-1] if self.is_white else pgn[-1].lower() pgn = pgn[:-1] elif pgn[-2] in "QBRN": finPZ = pgn[-2] if self.is_white else pgn[-2].lower() if info: info = pgn[-1] + info else: info = pgn[-1] pgn = pgn[:-2] salto_finPZ = -6 if info and not finPZ: pgn += info info = None rect = option.rect wTotal = rect.width() hTotal = rect.height() xTotal = rect.x() yTotal = rect.y() if option.state & QtWidgets.QStyle.State_Selected: painter.fillRect(rect, QtGui.QColor(Code.configuration.pgn_selbackground( ))) # sino no se ve en CDE-Motif-Windows elif self.siFondo: fondo = index.model().getFondo(index) if fondo: painter.fillRect(rect, fondo) if indicadorInicial: painter.save() painter.translate(xTotal, yTotal) painter.drawPixmap(0, 0, dicPM[indicadorInicial]) painter.restore() documentPGN = QtGui.QTextDocument() documentPGN.setDefaultFont(option.font) if color: pgn = '<font color="%s"><b>%s</b></font>' % (color, pgn) documentPGN.setHtml(pgn) wPGN = documentPGN.idealWidth() hPGN = documentPGN.size().height() hx = hPGN * 80 / 100 wpz = int(hx * 0.8) if info: documentINFO = QtGui.QTextDocument() documentINFO.setDefaultFont(option.font) if color: info = '<font color="%s"><b>%s</b></font>' % (color, info) documentINFO.setHtml(info) wINFO = documentINFO.idealWidth() ancho = wPGN if iniPZ: ancho += wpz if finPZ: ancho += wpz + salto_finPZ if info: ancho += wINFO if li_nags: ancho += wpz * len(li_nags) x = xTotal + (wTotal - ancho) / 2 if self.siAlineacion: alineacion = index.model().getAlineacion(index) if alineacion == "i": x = xTotal + 3 elif alineacion == "d": x = xTotal + (wTotal - ancho - 3) x = xTotal + 20 y = yTotal + (hTotal - hPGN * 0.9) / 2 if iniPZ: painter.save() painter.translate(x, y) pm = dicPZ[iniPZ] pmRect = QtCore.QRectF(0, 0, hx, hx) pm.render(painter, pmRect) painter.restore() x += wpz painter.save() painter.translate(x, y) documentPGN.drawContents(painter) painter.restore() x += wPGN if finPZ: painter.save() painter.translate(x - 0.3 * wpz, y) pm = dicPZ[finPZ] pmRect = QtCore.QRectF(0, 0, hx, hx) pm.render(painter, pmRect) painter.restore() x += wpz + salto_finPZ if info: painter.save() painter.translate(x, y) documentINFO.drawContents(painter) painter.restore() x += wINFO if li_nags: for rndr in li_nags: painter.save() painter.translate(x - 0.2 * wpz, y) pmRect = QtCore.QRectF(0, 0, hx, hx) rndr.render(painter, pmRect) painter.restore() x += wpz
QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Horizontal) spaceY = self.spacing() + wid.style().layoutSpacing( QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Vertical) nextX = x + item.sizeHint().width() + spaceX if nextX - spaceX > rect.right() and lineHeight > 0: x = rect.x() y = y + lineHeight + spaceY nextX = x + item.sizeHint().width() + spaceX lineHeight = 0 if not testOnly: item.setGeometry( QtCore.QRect(QtCore.QPoint(x, y), item.sizeHint())) x = nextX lineHeight = max(lineHeight, item.sizeHint().height()) return y + lineHeight - rect.y() if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) mainWin = Window() mainWin.show() sys.exit(app.exec_())
def setupUi(self, wg_Playblast): wg_Playblast.setObjectName("wg_Playblast") wg_Playblast.resize(340, 374) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(wg_Playblast.sizePolicy().hasHeightForWidth()) wg_Playblast.setSizePolicy(sizePolicy) wg_Playblast.setMinimumSize(QtCore.QSize(340, 0)) wg_Playblast.setMaximumSize(QtCore.QSize(340, 16777215)) self.verticalLayout = QtWidgets.QVBoxLayout(wg_Playblast) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.widget_4 = QtWidgets.QWidget(wg_Playblast) self.widget_4.setObjectName("widget_4") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget_4) self.horizontalLayout_4.setContentsMargins(-1, 0, 18, 0) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.l_name = QtWidgets.QLabel(self.widget_4) self.l_name.setObjectName("l_name") self.horizontalLayout_4.addWidget(self.l_name) self.e_name = QtWidgets.QLineEdit(self.widget_4) self.e_name.setObjectName("e_name") self.horizontalLayout_4.addWidget(self.e_name) self.l_class = QtWidgets.QLabel(self.widget_4) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.l_class.setFont(font) self.l_class.setObjectName("l_class") self.horizontalLayout_4.addWidget(self.l_class) self.verticalLayout.addWidget(self.widget_4) self.groupBox = QtWidgets.QGroupBox(wg_Playblast) self.groupBox.setObjectName("groupBox") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout_2.setObjectName("verticalLayout_2") self.widget_10 = QtWidgets.QWidget(self.groupBox) self.widget_10.setObjectName("widget_10") self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.widget_10) self.horizontalLayout_10.setContentsMargins(-1, 0, -1, 0) self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.label_2 = QtWidgets.QLabel(self.widget_10) self.label_2.setObjectName("label_2") self.horizontalLayout_10.addWidget(self.label_2) self.l_taskName = QtWidgets.QLabel(self.widget_10) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.l_taskName.sizePolicy().hasHeightForWidth()) self.l_taskName.setSizePolicy(sizePolicy) self.l_taskName.setText("") self.l_taskName.setAlignment(QtCore.Qt.AlignCenter) self.l_taskName.setObjectName("l_taskName") self.horizontalLayout_10.addWidget(self.l_taskName) self.b_changeTask = QtWidgets.QPushButton(self.widget_10) self.b_changeTask.setEnabled(True) self.b_changeTask.setFocusPolicy(QtCore.Qt.NoFocus) self.b_changeTask.setObjectName("b_changeTask") self.horizontalLayout_10.addWidget(self.b_changeTask) self.verticalLayout_2.addWidget(self.widget_10) self.widget_2 = QtWidgets.QWidget(self.groupBox) self.widget_2.setObjectName("widget_2") self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget_2) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setContentsMargins(9, 0, 9, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.label_3 = QtWidgets.QLabel(self.widget_2) self.label_3.setObjectName("label_3") self.horizontalLayout.addWidget(self.label_3) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.cb_rangeType = QtWidgets.QComboBox(self.widget_2) self.cb_rangeType.setObjectName("cb_rangeType") self.horizontalLayout.addWidget(self.cb_rangeType) self.verticalLayout_2.addWidget(self.widget_2) self.f_frameRange_2 = QtWidgets.QWidget(self.groupBox) self.f_frameRange_2.setObjectName("f_frameRange_2") self.gridLayout = QtWidgets.QGridLayout(self.f_frameRange_2) self.gridLayout.setContentsMargins(-1, 0, -1, 0) self.gridLayout.setObjectName("gridLayout") self.l_rangeEnd = QtWidgets.QLabel(self.f_frameRange_2) self.l_rangeEnd.setMinimumSize(QtCore.QSize(30, 0)) self.l_rangeEnd.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.l_rangeEnd.setObjectName("l_rangeEnd") self.gridLayout.addWidget(self.l_rangeEnd, 1, 5, 1, 1) self.sp_rangeEnd = QtWidgets.QSpinBox(self.f_frameRange_2) self.sp_rangeEnd.setMaximumSize(QtCore.QSize(55, 16777215)) self.sp_rangeEnd.setMaximum(99999) self.sp_rangeEnd.setProperty("value", 1100) self.sp_rangeEnd.setObjectName("sp_rangeEnd") self.gridLayout.addWidget(self.sp_rangeEnd, 1, 6, 1, 1) self.sp_rangeStart = QtWidgets.QSpinBox(self.f_frameRange_2) self.sp_rangeStart.setMaximumSize(QtCore.QSize(55, 16777215)) self.sp_rangeStart.setMaximum(99999) self.sp_rangeStart.setProperty("value", 1001) self.sp_rangeStart.setObjectName("sp_rangeStart") self.gridLayout.addWidget(self.sp_rangeStart, 0, 6, 1, 1) self.l_rangeStart = QtWidgets.QLabel(self.f_frameRange_2) self.l_rangeStart.setMinimumSize(QtCore.QSize(30, 0)) self.l_rangeStart.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.l_rangeStart.setObjectName("l_rangeStart") self.gridLayout.addWidget(self.l_rangeStart, 0, 5, 1, 1) self.l_rangeStartInfo = QtWidgets.QLabel(self.f_frameRange_2) self.l_rangeStartInfo.setObjectName("l_rangeStartInfo") self.gridLayout.addWidget(self.l_rangeStartInfo, 0, 0, 1, 1) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem1, 0, 4, 1, 1) self.l_rangeEndInfo = QtWidgets.QLabel(self.f_frameRange_2) self.l_rangeEndInfo.setObjectName("l_rangeEndInfo") self.gridLayout.addWidget(self.l_rangeEndInfo, 1, 0, 1, 1) self.verticalLayout_2.addWidget(self.f_frameRange_2) self.widget = QtWidgets.QWidget(self.groupBox) self.widget.setObjectName("widget") self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget) self.horizontalLayout_2.setContentsMargins(9, 0, 9, 0) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(self.widget) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem2) self.cb_cams = QtWidgets.QComboBox(self.widget) self.cb_cams.setMinimumSize(QtCore.QSize(150, 0)) self.cb_cams.setObjectName("cb_cams") self.horizontalLayout_2.addWidget(self.cb_cams) self.verticalLayout_2.addWidget(self.widget) self.f_resolution = QtWidgets.QWidget(self.groupBox) self.f_resolution.setObjectName("f_resolution") self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.f_resolution) self.horizontalLayout_9.setSpacing(6) self.horizontalLayout_9.setContentsMargins(9, 0, 9, 0) self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.label_6 = QtWidgets.QLabel(self.f_resolution) self.label_6.setObjectName("label_6") self.horizontalLayout_9.addWidget(self.label_6) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem3) self.chb_resOverride = QtWidgets.QCheckBox(self.f_resolution) self.chb_resOverride.setText("") self.chb_resOverride.setChecked(True) self.chb_resOverride.setObjectName("chb_resOverride") self.horizontalLayout_9.addWidget(self.chb_resOverride) self.sp_resWidth = QtWidgets.QSpinBox(self.f_resolution) self.sp_resWidth.setEnabled(True) self.sp_resWidth.setMinimum(1) self.sp_resWidth.setMaximum(99999) self.sp_resWidth.setProperty("value", 1280) self.sp_resWidth.setObjectName("sp_resWidth") self.horizontalLayout_9.addWidget(self.sp_resWidth) self.sp_resHeight = QtWidgets.QSpinBox(self.f_resolution) self.sp_resHeight.setEnabled(True) self.sp_resHeight.setMinimum(1) self.sp_resHeight.setMaximum(99999) self.sp_resHeight.setProperty("value", 720) self.sp_resHeight.setObjectName("sp_resHeight") self.horizontalLayout_9.addWidget(self.sp_resHeight) self.b_resPresets = QtWidgets.QPushButton(self.f_resolution) self.b_resPresets.setEnabled(True) self.b_resPresets.setMinimumSize(QtCore.QSize(23, 23)) self.b_resPresets.setMaximumSize(QtCore.QSize(23, 23)) self.b_resPresets.setObjectName("b_resPresets") self.horizontalLayout_9.addWidget(self.b_resPresets) self.verticalLayout_2.addWidget(self.f_resolution) self.f_displayMode = QtWidgets.QWidget(self.groupBox) self.f_displayMode.setObjectName("f_displayMode") self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.f_displayMode) self.horizontalLayout_11.setContentsMargins(9, 0, 9, 0) self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.label_7 = QtWidgets.QLabel(self.f_displayMode) self.label_7.setObjectName("label_7") self.horizontalLayout_11.addWidget(self.label_7) spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem4) self.cb_displayMode = QtWidgets.QComboBox(self.f_displayMode) self.cb_displayMode.setMinimumSize(QtCore.QSize(150, 0)) self.cb_displayMode.setObjectName("cb_displayMode") self.horizontalLayout_11.addWidget(self.cb_displayMode) self.verticalLayout_2.addWidget(self.f_displayMode) self.f_localOutput = QtWidgets.QWidget(self.groupBox) self.f_localOutput.setObjectName("f_localOutput") self.horizontalLayout_16 = QtWidgets.QHBoxLayout(self.f_localOutput) self.horizontalLayout_16.setContentsMargins(-1, 0, -1, 0) self.horizontalLayout_16.setObjectName("horizontalLayout_16") self.l_localOutput = QtWidgets.QLabel(self.f_localOutput) self.l_localOutput.setObjectName("l_localOutput") self.horizontalLayout_16.addWidget(self.l_localOutput) spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_16.addItem(spacerItem5) self.chb_localOutput = QtWidgets.QCheckBox(self.f_localOutput) self.chb_localOutput.setText("") self.chb_localOutput.setChecked(True) self.chb_localOutput.setObjectName("chb_localOutput") self.horizontalLayout_16.addWidget(self.chb_localOutput) self.verticalLayout_2.addWidget(self.f_localOutput) self.widget_5 = QtWidgets.QWidget(self.groupBox) self.widget_5.setObjectName("widget_5") self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget_5) self.horizontalLayout_5.setSpacing(0) self.horizontalLayout_5.setContentsMargins(9, 0, 9, 0) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_5 = QtWidgets.QLabel(self.widget_5) self.label_5.setObjectName("label_5") self.horizontalLayout_5.addWidget(self.label_5) spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem6) self.cb_formats = QtWidgets.QComboBox(self.widget_5) self.cb_formats.setMinimumSize(QtCore.QSize(150, 0)) self.cb_formats.setObjectName("cb_formats") self.horizontalLayout_5.addWidget(self.cb_formats) self.verticalLayout_2.addWidget(self.widget_5) self.verticalLayout.addWidget(self.groupBox) self.groupBox_3 = QtWidgets.QGroupBox(wg_Playblast) self.groupBox_3.setCheckable(False) self.groupBox_3.setChecked(False) self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_3) self.verticalLayout_4.setContentsMargins(18, -1, 18, -1) self.verticalLayout_4.setObjectName("verticalLayout_4") self.l_pathLast = QtWidgets.QLabel(self.groupBox_3) self.l_pathLast.setObjectName("l_pathLast") self.verticalLayout_4.addWidget(self.l_pathLast) self.widget_21 = QtWidgets.QWidget(self.groupBox_3) self.widget_21.setObjectName("widget_21") self.horizontalLayout_19 = QtWidgets.QHBoxLayout(self.widget_21) self.horizontalLayout_19.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_19.setObjectName("horizontalLayout_19") self.b_openLast = QtWidgets.QPushButton(self.widget_21) self.b_openLast.setEnabled(False) self.b_openLast.setFocusPolicy(QtCore.Qt.NoFocus) self.b_openLast.setObjectName("b_openLast") self.horizontalLayout_19.addWidget(self.b_openLast) self.b_copyLast = QtWidgets.QPushButton(self.widget_21) self.b_copyLast.setEnabled(False) self.b_copyLast.setFocusPolicy(QtCore.Qt.NoFocus) self.b_copyLast.setObjectName("b_copyLast") self.horizontalLayout_19.addWidget(self.b_copyLast) self.verticalLayout_4.addWidget(self.widget_21) self.verticalLayout.addWidget(self.groupBox_3) self.retranslateUi(wg_Playblast) QtCore.QMetaObject.connectSlotsByName(wg_Playblast)
def __init__(self, parent): """ Create a summary tab for a SMH analysis session. :param parent: The parent widget. """ super(SummaryTab, self).__init__(parent) self.parent = parent # Right pane: A MPL figure with two axes, vertically aligned. # Left pane: # - Name, RA/DEC # - Link to search on Vizier/Simbad # - Comments/notes (user info?) # Set a size policy. sp = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding) sp.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sp) # Create a top-level horizontal layout to contain a MPL figure and # a vertical layout of settings.. tab_layout = QtGui.QHBoxLayout(self) tab_layout.setContentsMargins(20, 20, 20, 0) # Create the left hand pane. summary_widget = QtGui.QWidget() summary_layout = QtGui.QVBoxLayout(summary_widget) # Star name label. self.star_label = QtGui.QLabel(self) bold_monospaced = QtGui2.QFont("Courier", 14) bold_monospaced.setBold(True) self.star_label.setFont(bold_monospaced) summary_layout.addWidget(self.star_label) # Coordinates label. self.coordinates_label = QtGui.QLabel(self) self.coordinates_label.setFont(bold_monospaced) summary_layout.addWidget(self.coordinates_label) # Notes. self.summary_notes = QtGui.QPlainTextEdit(self) summary_layout.addWidget(self.summary_notes) # External sources of information. hbox = QtGui.QHBoxLayout() # - Simbad self.btn_query_simbad = QtGui.QPushButton(self) self.btn_query_simbad.setText("Query Simbad..") self.btn_query_simbad.clicked.connect(self.query_simbad) hbox.addWidget(self.btn_query_simbad) hbox.addItem( QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)) summary_layout.addLayout(hbox) tab_layout.addWidget(summary_widget) # Create a matplotlib widget in the right hand pane. self.figure = mpl.MPLWidget(None, tight_layout=True) sp = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sp.setHorizontalStretch(0) sp.setVerticalStretch(0) sp.setHeightForWidth(self.figure.sizePolicy().hasHeightForWidth()) self.figure.setSizePolicy(sp) self.figure.setFixedWidth(400) tab_layout.addWidget(self.figure) self.ax_top_comparison = self.figure.figure.add_subplot(211) self.ax_bottom_comparison = self.figure.figure.add_subplot(212) # Initialize the widgets. self._populate_widgets() # Connect the widgets. self.summary_notes.textChanged.connect(self.update_summary_notes) return None
import cuegui.AbstractTreeWidget import cuegui.AbstractWidgetItem import cuegui.Constants import cuegui.ItemDelegate import cuegui.Logger import cuegui.MenuActions import cuegui.Style import cuegui.Utils logger = cuegui.Logger.getLogger(__file__) COLUMN_COMMENT = 1 COLUMN_EAT = 2 COLUMN_MAXRSS = 13 FONT_BOLD = QtGui.QFont("Luxi Sans", -1, QtGui.QFont.Bold) UPDATE_INTERVAL = 22 def getEta(stats): if stats.runningFrames: remaining = (((stats.pendingFrames - 1) * stats.avgFrameSec) + stats.highFrameSec) if remaining: return cuegui.Utils.secondsToHHHMM(remaining // stats.runningFrames) return "-" class CueJobMonitorTree(cuegui.AbstractTreeWidget.AbstractTreeWidget):
def run(self): while True: self.mutex.lock() resultSize = self.resultSize scaleFactor = self.scaleFactor centerX = self.centerX centerY = self.centerY self.mutex.unlock() halfWidth = int(resultSize.width() / 2) halfHeight = int(resultSize.height() / 2) image = QtGui.QImage(resultSize, QtGui.QImage.Format_RGB32) NumPasses = 8 curpass = 0 while curpass < NumPasses: MaxIterations = (1 << (2 * curpass + 6)) + 32 Limit = 4 allBlack = True for y in range(-halfHeight, halfHeight): if self.restart: break if self.abort: return ay = 1j * (centerY + (y * scaleFactor)) for x in range(-halfWidth, halfWidth): c0 = centerX + (x * scaleFactor) + ay c = c0 numIterations = 0 while numIterations < MaxIterations: numIterations += 1 c = c*c + c0 if abs(c) >= Limit: break numIterations += 1 c = c*c + c0 if abs(c) >= Limit: break numIterations += 1 c = c*c + c0 if abs(c) >= Limit: break numIterations += 1 c = c*c + c0 if abs(c) >= Limit: break if numIterations < MaxIterations: image.setPixel(x + halfWidth, y + halfHeight, self.colormap[numIterations % RenderThread.ColormapSize]) allBlack = False else: image.setPixel(x + halfWidth, y + halfHeight, QtGui.qRgb(0, 0, 0)) if allBlack and curpass == 0: curpass = 4 else: if not self.restart: self.emit(QtCore.SIGNAL("renderedImage(const QImage &, double)"), image, scaleFactor) curpass += 1 self.mutex.lock() if not self.restart: self.condition.wait(self.mutex) self.restart = False self.mutex.unlock()
def __init__(self, parent=None): super(MyWindow, self).__init__(parent) self.setupUi(self) self.setAcceptDrops(True) self.setWindowIcon(QtGui.QIcon(':/file_edit1.ico'))
def setupUi(self, overnight_popup, num_guides, current_date, trip_role_assignment, DialogBox): """Sets up all of the objects and adds them to the DialogBox Parameters ---------- overnight_popup: QDialog A QDialog object created in create_schedule_day() that allows the dialog to be created by the method when needed num_guides: int The number of guides needed for the trip current_date : date A date object representing the date for which a schedule must be created trip_role_assignment: dict An empty dictionary to be filled with the names of the staff members assigned to each role DialogBox: QDialog A QDialog object created in create_schedule_day() that allows the dialog to be created by the method when needed Method Calls ------------ -retranslateUi() """ self.DialogBox = DialogBox self.num_guides = num_guides self.trip_role_assignment = trip_role_assignment self.comboBoxes = [0, 0, 0, 0] self.labels = [0, 0, 0, 0] overnight_popup.setObjectName("overnight_popup") overnight_popup.resize(700, 500) overnight_popup.setStyleSheet("color: #ee7838;\n" "background-color: white;") font = QtGui.QFont() font.setFamily("Malgun Gothic") self.main_label = QtWidgets.QLabel(overnight_popup) self.main_label.setGeometry(QtCore.QRect(25, 25, 650, 50)) self.main_label.setFont(font) self.main_label.setStyleSheet(" background-color: #006898;\n" " border-radius: 5%;\n" "padding-left: 15px;") self.main_label.setObjectName("main_label") x_text = 175 y_text = 112.5 x_label = 25 y_label = 94 for n in range(num_guides): guides_available = manage_staff.staff_util.get_guides_can_work( 4, create_schedule.schedule_dictionaries.guide_roles_converter[n]) self.comboBoxes[n] = QtWidgets.QComboBox(overnight_popup) self.comboBoxes[n].setGeometry( QtCore.QRect(x_text, y_text, 200, 30)) self.comboBoxes[n].setObjectName("comboBox") self.comboBoxes[n].addItem("Choose Guide...") for m in enumerate(guides_available): self.comboBoxes[n].addItem(guides_available[m]) self.labels[n] = QtWidgets.QLabel(overnight_popup) self.labels[n].setGeometry(QtCore.QRect(x_label, y_label, 125, 60)) self.labels[n].setStyleSheet("") self.labels[n].setObjectName(create_schedule.schedule_dictionaries. overnight_dialog_guide_label_name[n]) y_text += 50 y_label += 62.5 if (num_guides == 1): guides_available = manage_staff.staff_util.get_guides_can_work( 4, create_schedule.schedule_dictionaries.guide_roles_converter[4]) self.safety_name = QtWidgets.QComboBox(overnight_popup) self.safety_name.setGeometry(QtCore.QRect(x_text, y_text, 200, 30)) self.safety_name.setObjectName("comboBox") self.safety_name.addItem("Choose Guide...") for m in enumerate(guides_available): self.safety_name.addItem(guides_available[m]) self.safety_label = QtWidgets.QLabel(overnight_popup) self.safety_label.setGeometry( QtCore.QRect(x_label, y_label, 81, 41)) self.safety_label.setStyleSheet("") self.safety_label.setObjectName("safety_label") self.submit = QtWidgets.QPushButton(overnight_popup) self.submit.setGeometry(QtCore.QRect(575, 400, 100, 35)) self.submit.setStyleSheet(" border: none;\n" " padding: 0.5%;\n" " cursor: pointer;\n" " font-family: special_font;\n" " font-size: 12pt;\n" " border-radius: 3%;\n" " opacity: 0.9;\n" " background-color: #006898;\n" " color: #ee7838;") self.submit.setObjectName("submit") self.submit.clicked.connect(self.submit_staff) self.submit.show() self.retranslateUi(overnight_popup, num_guides, self.labels, current_date) QtCore.QMetaObject.connectSlotsByName(overnight_popup)
def clearImage(self): self.image.fill(QtGui.qRgb(255, 255, 255)) self.modified = True self.update()
def barrelHit(self, pos): matrix = QtGui.QTransform() matrix.translate(0, self.height()) matrix.rotate(-self.currentAngle) matrix, invertible = matrix.inverted() return self.barrelRect.contains(matrix.map(pos))
def setupUi(self, ModeShapesWidget): ModeShapesWidget.setObjectName("ModeShapesWidget") ModeShapesWidget.resize(1333, 385) self.gridLayout = QtWidgets.QGridLayout(ModeShapesWidget) self.gridLayout.setObjectName("gridLayout") self.frame = QtWidgets.QFrame(ModeShapesWidget) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.verticalLayout = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout.setObjectName("verticalLayout") self.tableWidget = QtWidgets.QTableWidget(self.frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tableWidget.sizePolicy().hasHeightForWidth()) self.tableWidget.setSizePolicy(sizePolicy) self.tableWidget.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.tableWidget.setFrameShape(QtWidgets.QFrame.NoFrame) self.tableWidget.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget.setAlternatingRowColors(False) self.tableWidget.setShowGrid(True) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(7) self.tableWidget.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(5, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(6, item) self.verticalLayout.addWidget(self.tableWidget) self.gridLayout.addWidget(self.frame, 3, 2, 1, 4) self.line = QtWidgets.QFrame(ModeShapesWidget) self.line.setFrameShape(QtWidgets.QFrame.VLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.gridLayout.addWidget(self.line, 0, 1, 1, 1) self.line_2 = QtWidgets.QFrame(ModeShapesWidget) self.line_2.setFrameShape(QtWidgets.QFrame.VLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.gridLayout.addWidget(self.line_2, 0, 3, 1, 1) self.line_3 = QtWidgets.QFrame(ModeShapesWidget) self.line_3.setFrameShape(QtWidgets.QFrame.VLine) self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") self.gridLayout.addWidget(self.line_3, 1, 3, 1, 1) self.line_4 = QtWidgets.QFrame(ModeShapesWidget) self.line_4.setFrameShape(QtWidgets.QFrame.VLine) self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_4.setObjectName("line_4") self.gridLayout.addWidget(self.line_4, 1, 1, 1, 1) self.frame_2 = QtWidgets.QFrame(ModeShapesWidget) self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame_2) self.verticalLayout_2.setContentsMargins(0, -1, 0, -1) self.verticalLayout_2.setObjectName("verticalLayout_2") self.pushButton_2 = QtWidgets.QPushButton(self.frame_2) self.pushButton_2.setObjectName("pushButton_2") self.verticalLayout_2.addWidget(self.pushButton_2) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.gridLayout.addWidget(self.frame_2, 3, 0, 1, 1) self.btnCalc = QtWidgets.QPushButton(ModeShapesWidget) self.btnCalc.setCheckable(False) self.btnCalc.setChecked(False) self.btnCalc.setObjectName("btnCalc") self.gridLayout.addWidget(self.btnCalc, 0, 0, 1, 1) self.label = QtWidgets.QLabel(ModeShapesWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 4, 1, 1) self.lblPeriod = QtWidgets.QLabel(ModeShapesWidget) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.lblPeriod.setFont(font) self.lblPeriod.setObjectName("lblPeriod") self.gridLayout.addWidget(self.lblPeriod, 0, 2, 1, 1) self.label_2 = QtWidgets.QLabel(ModeShapesWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 4, 1, 1) self.sliderSize = QtWidgets.QSlider(ModeShapesWidget) self.sliderSize.setMinimum(1) self.sliderSize.setMaximum(100) self.sliderSize.setProperty("value", 10) self.sliderSize.setOrientation(QtCore.Qt.Horizontal) self.sliderSize.setTickPosition(QtWidgets.QSlider.NoTicks) self.sliderSize.setObjectName("sliderSize") self.gridLayout.addWidget(self.sliderSize, 1, 5, 1, 1) self.horizontalSlider = QtWidgets.QSlider(ModeShapesWidget) self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.horizontalSlider.setTickPosition(QtWidgets.QSlider.TicksAbove) self.horizontalSlider.setObjectName("horizontalSlider") self.gridLayout.addWidget(self.horizontalSlider, 0, 5, 1, 1) self.lblRads = QtWidgets.QLabel(ModeShapesWidget) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.lblRads.setFont(font) self.lblRads.setObjectName("lblRads") self.gridLayout.addWidget(self.lblRads, 1, 2, 1, 1) self.lblError = QtWidgets.QLabel(ModeShapesWidget) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.lblError.setFont(font) self.lblError.setStyleSheet("color:rgb(200, 0, 0)") self.lblError.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.lblError.setTextFormat(QtCore.Qt.AutoText) self.lblError.setObjectName("lblError") self.gridLayout.addWidget(self.lblError, 1, 0, 1, 1) self.retranslateUi(ModeShapesWidget) QtCore.QMetaObject.connectSlotsByName(ModeShapesWidget)
def setupUi(self, Form): self.form = Form Form.setObjectName("Form") Form.resize(800, 600) Form.setWindowIcon(QtGui.QIcon("860139 copy 2.png")) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) Form.setMaximumSize(QtCore.QSize(800, 600)) Form.setMinimumSize(QtCore.QSize(800, 600)) self.Background = QtWidgets.QLabel(Form) self.Background.setGeometry(QtCore.QRect(0, 0, 801, 601)) self.Background.setStyleSheet("QLabel{background: papayawhip;}") self.Background.setText("") self.Background.setObjectName("Background") self.LOGO = QtWidgets.QLabel(Form) self.LOGO.setGeometry(QtCore.QRect(190, 70, 386, 58)) font = QtGui.QFont() font.setFamily("Georgia") font.setPointSize(30) font.setWeight(75) font.setItalic(True) font.setBold(True) self.LOGO.setFont(font) self.LOGO.setStyleSheet("QLabel{color:steelblue;}\n" "") self.LOGO.setObjectName("LOGO") self.logo_pic = QtWidgets.QLabel(Form) self.logo_pic.setGeometry(QtCore.QRect(580, 80, 81, 51)) self.logo_pic.setText("") self.logo_pic.setPixmap( QtGui.QPixmap( "purepng.com-white-paper-planpaper-planeaeroplanepaper-gliderpaper-dartaircraftfolded-paperpaperboardclipart-1421526588176couen copy 2.png" )) self.logo_pic.setObjectName("logo_pic") self.username = QtWidgets.QLabel(Form) self.username.setGeometry(QtCore.QRect(300, 150, 121, 31)) font = QtGui.QFont() font.setFamily("Georgia") font.setPointSize(14) self.username.setFont(font) self.username.setStyleSheet("QLabel{color:dimgrey;}\n" "") self.username.setObjectName("username") self.username_lineEdit = QtWidgets.QLineEdit(Form) self.username_lineEdit.setGeometry(QtCore.QRect(300, 180, 181, 31)) self.username_lineEdit.setObjectName("username_lineEdit") self.password = QtWidgets.QLabel(Form) self.password.setGeometry(QtCore.QRect(300, 230, 101, 16)) font = QtGui.QFont() font.setFamily("Georgia") font.setPointSize(14) self.password.setFont(font) self.password.setStyleSheet("QLabel{color:dimgrey;}\n" "") self.password.setObjectName("password") self.password_lineEdit = QtWidgets.QLineEdit(Form) self.password_lineEdit.setGeometry(QtCore.QRect(300, 250, 181, 31)) self.password_lineEdit.setInputMethodHints( QtCore.Qt.ImhHiddenText | QtCore.Qt.ImhNoAutoUppercase | QtCore.Qt.ImhNoPredictiveText | QtCore.Qt.ImhSensitiveData) self.password_lineEdit.setEchoMode(QtWidgets.QLineEdit.Password) self.password_lineEdit.setObjectName("password_lineEdit") self.SignIn = QtWidgets.QPushButton(Form) self.SignIn.setGeometry(QtCore.QRect(260, 310, 113, 32)) font = QtGui.QFont() font.setFamily("Georgia") self.SignIn.setFont(font) self.SignIn.setStyleSheet("") self.SignIn.setObjectName("SignIn") self.SignUp = QtWidgets.QPushButton(Form) self.SignUp.setGeometry(QtCore.QRect(420, 310, 113, 32)) font = QtGui.QFont() font.setFamily("Georgia") self.SignUp.setFont(font) self.SignUp.setObjectName("SignUp") self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(-40, 340, 841, 261)) self.label.setText("") self.label.setPixmap(QtGui.QPixmap("paper_plane_PNG20 copy 2.png")) self.label.setObjectName("label") self.SignUp.clicked.connect(self.callUserSignUp) self.SignIn.clicked.connect(self.callNextPage) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)