def dropShadow(): effect = QGraphicsDropShadowEffect() effect.setBlurRadius(15) effect.setXOffset(0) effect.setYOffset(3) effect.setColor(QColor(0, 0, 0, 30)) return effect
def dropShadowUp(): effect = QGraphicsDropShadowEffect() effect.setBlurRadius(10) effect.setXOffset(0) effect.setYOffset(-3) effect.setColor(QColor(0, 0, 0, 25)) return effect
def shadow() -> QGraphicsDropShadowEffect: s = QGraphicsDropShadowEffect() s.setBlurRadius(10) s.setXOffset(2) s.setYOffset(2) s.setColor(QColor(200, 200, 200)) return s
def __init__(self, workspace_name, is_owner, creator, files, shared_with=None, *args, **kwargs): super().__init__(*args, **kwargs) self.setupUi(self) self.is_owner = is_owner self.creator = creator self.shared_with = shared_with or [] self.name = workspace_name if not len(files): self.label_empty.show() self.widget_files.hide() else: for i, (f, is_dir) in enumerate(files.items(), 1): if i > 4: break label = getattr(self, "line_edit_file{}".format(i)) label.clicked.connect(self.open_clicked_file) label.setText(f) label.setIsDir(is_dir) label.setCursorPosition(0) self.label_empty.hide() effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(164, 164, 164)) effect.setBlurRadius(10) effect.setXOffset(4) effect.setYOffset(4) self.setGraphicsEffect(effect) self.button_details.clicked.connect(self.button_details_clicked) self.button_share.clicked.connect(self.button_share_clicked) self.button_delete.clicked.connect(self.button_delete_clicked) self.button_rename.clicked.connect(self.button_rename_clicked) if not self.is_owner: self.label_owner.hide() if not self.shared_with: self.label_shared.hide()
def __init__(self, user_name, is_current_user, is_admin, certified_on, is_revoked, current_user_is_admin): super().__init__() self.setupUi(self) self.current_user_is_admin = current_user_is_admin self.is_admin = is_admin self.is_revoked = is_revoked self._is_revoked = is_revoked self.certified_on = certified_on self.is_current_user = is_current_user self.user_name = user_name self.label_username.setText(user_name) self.user_icon.apply_style() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) self.label_created_on.setText( format_datetime(self.certified_on, full=True)) self.label_role.setText( _("TEXT_USER_ROLE_ADMIN") if self. is_admin else _("TEXT_USER_ROLE_CONTRIBUTOR")) if self.is_current_user: self.label_user_is_current.setText("({})".format( _("TEXT_USER_IS_CURRENT"))) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def setup_ui(self): """ Inicjalizacja interfejsu użytkownika. """ self.setObjectName("TestScoreWindow") self.setSizePolicy(self.get_size_policy()) self.setMinimumSize(QSize(500, 110)) self.setWindowTitle(self.window_title) self.setWindowIcon(QIcon(Paths.icon("window_icon.png"))) self.setStyleSheet(Styles.test_score_window_style) shadow = QGraphicsDropShadowEffect() shadow.setXOffset(0) shadow.setYOffset(5) shadow.setBlurRadius(10) self.control_panel = ControlPanel(self, Qt.AlignTop) self.score_label = self.control_panel.add_label(self.score) self.score_label.setStyleSheet( Styles.test_score_window_label_score_style + self.score_color_style) self.score_label.setGraphicsEffect(shadow) self.hint_label = self.control_panel.add_label(self.hint) self.hint_label.setStyleSheet( Styles.test_score_window_label_hint_style) self.setCentralWidget(self.control_panel)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(164, 164, 164)) effect.setBlurRadius(4) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def contar_apps(self): global selected_apps cuenta = len(selected_apps) if cuenta == 0: texto = "Seleccione las aplicaciones a instalar" borde = "border: 2px solid rgb(45, 45, 45);" r, g, b = 255, 255, 255 cursor = QtCore.ArrowCursor enabled = False pix_car = "carDisable.svg" else: borde = "border: 2px solid #419fd9;" r, g, b = 0, 255, 255 cursor = QtCore.PointingHandCursor enabled = True pix_car = "carEnable.svg" if cuenta != 1: acentuacion, articulo, plural = "o", "es", "s" else: acentuacion, articulo, plural = "ó", "", "" texto = "{} aplicaci{}n{} seleccionada{} para instalar, clic aquí para verla{}".format( cuenta, acentuacion, articulo, plural, plural) self.ui.btn_install.setEnabled(enabled) self.ui.lbl_list_apps.setEnabled(enabled) self.ui.lbl_list_apps.setCursor(QCursor(cursor)) pix_car = QPixmap(abspath(join(dirname(__file__), 'resources', pix_car))) self.ui.icon_car.setPixmap(pix_car) estilo = ("#btn_install{\n" "color: #fff;\n" "padding: 2px;\n" "border-radius: 5px;\n" "background-color: rgb(45, 45, 45);\n" + borde + "}\n" "#btn_install:hover{\n" "padding: 2px;\n" "color:white;\n" "background-color: rgb(65, 159, 217);\n" "border: 1px solid rgb(142, 231, 255);\n" "border-radius: 5px;\n" "}") self.ui.btn_install.setStyleSheet(estilo) shadow = QGraphicsDropShadowEffect(self, blurRadius=10, color=QColor(r,g,b), offset=QPointF(0, 0) ) shadow.setXOffset(0) shadow.setYOffset(0) self.ui.btn_install.setGraphicsEffect(shadow) self.ui.lbl_list_apps.setText(texto)
class Text(QLabel): def __init__(self, text='', font_size=24, color='green', font='Inconsolata', bloom_radius=16, debug=False, *args, **kwargs): super().__init__(text, *args, **kwargs) self._init_style(font, font_size) self._init_bloom_effect(bloom_radius) self.set_color(color) if debug: self.setFrameStyle(QFrame.Box | QFrame.Raised) def setText(self, txt): try: super().setText(txt) except BaseException: logging.exception("Failed to set text") def set_color(self, color): """Set the text color""" c = palette[color] style_c = f'rgba({c.red()}, {c.green()}, {c.blue()}, {c.alpha()})' self.setStyleSheet('QLabel { color: ' + style_c + '; }') self.bloom.setColor(c) def set_alignement(self, a): try: alignments = { 'left': Qt.AlignVCenter | Qt.AlignLeft, 'center': Qt.AlignCenter, 'right': Qt.AlignVCenter | Qt.AlignRight } self.setAlignment(alignments[a]) except BaseException: logging.exception("Failed to set text alignment") def _init_style(self, font, font_size): """Create font, set size, alignement and word wrap""" self.setFont(QFont(font, font_size)) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setAlignment(Qt.AlignCenter) self.setWordWrap(True) self.setMargin(64) def _init_bloom_effect(self, radius=32): """Create a bloom effect""" self.bloom = QGraphicsDropShadowEffect() self.bloom.setBlurRadius(radius) self.bloom.setXOffset(0) self.bloom.setYOffset(0) self.setGraphicsEffect(self.bloom)
def __init__(self): super().__init__() self.setWindowTitle("Login") self.setGeometry(350, 45, 771, 681) vLayout = QVBoxLayout() self.vWidgetLayout = QVBoxLayout() container_widget = QWidget() shadow = QGraphicsDropShadowEffect() shadow.setBlurRadius(3) shadow.setColor(QColor("#010101")) shadow.setXOffset(3) shadow.setYOffset(3) username_label = QLabel("Username") username_label.setStyleSheet("border: none; font-size: 15px;") username_input = QLineEdit() username_input.setStyleSheet( "background: none; border-top: none; border-left: none; border-right: none; border-bottom: 1px solid #010101; font-size: 14px;" ) username_input.setFixedWidth(200) password_label = QLabel("Password") password_label.setStyleSheet("border: none; font-size: 15px;") password_input = QLineEdit() password_input.setEchoMode(QLineEdit.Password) password_input.setStyleSheet( "border-top: none; border-left: none; border-right: none; border-bottom: 1px solid #010101; font-size: 14px;" ) password_input.setFixedWidth(200) self.login_btn = QPushButton("Login") self.login_btn.setStyleSheet( "QPushButton { border-radius: 3px; font-size: 12px; }" "QPushButton:pressed { background: black; color: white; }") self.login_btn.setFixedWidth(50) self.login_btn.setFixedHeight(25) self._addWidgets(username_label, username_input, password_label, password_input, self.login_btn) container_widget.setStyleSheet( "background: white; border: 0.5px solid #010101; border-radius: 10px; font-family: Lucida Console, Monaco, monospace; font-weight: bold;" ) container_widget.setLayout(self.vWidgetLayout) container_widget.setFixedHeight(200) container_widget.setFixedWidth(300) container_widget.setGraphicsEffect(shadow) self.vWidgetLayout.setSpacing(20) self.vWidgetLayout.setAlignment(Qt.AlignCenter) vLayout.addWidget(container_widget) vLayout.setAlignment(Qt.AlignCenter) self.setLayout(vLayout)
def __init__(self, core_config, *args, **kwargs): super().__init__(*args, **kwargs) self.setupUi(self) self.menu = MenuWidget(parent=self) self.widget_menu.layout().addWidget(self.menu) self.mount_widget = MountWidget(parent=self) self.mount_widget.reset_taskbar.connect(self.reset_taskbar) self.widget_central.layout().insertWidget(0, self.mount_widget) self.users_widget = UsersWidget(parent=self) self.widget_central.layout().insertWidget(0, self.users_widget) self.devices_widget = DevicesWidget(parent=self) self.widget_central.layout().insertWidget(0, self.devices_widget) self.settings_widget = SettingsWidget(core_config=core_config, parent=self) self.widget_central.layout().insertWidget(0, self.settings_widget) self.notification_center = NotificationCenterWidget(parent=self) self.button_notif = TaskbarButton( icon_path=":/icons/images/icons/menu_settings.png") self.widget_notif.layout().addWidget(self.notification_center) self.notification_center.hide() effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(100, 100, 100)) effect.setBlurRadius(4) effect.setXOffset(-2) effect.setYOffset(2) self.widget_notif.setGraphicsEffect(effect) self.menu.button_files.clicked.connect(self.show_mount_widget) self.menu.button_users.clicked.connect(self.show_users_widget) self.menu.button_settings.clicked.connect(self.show_settings_widget) self.menu.button_devices.clicked.connect(self.show_devices_widget) self.menu.button_logout.clicked.connect(self.logout_requested.emit) self.button_notif.clicked.connect(self.show_notification_center) self.connection_state_changed.connect( self._on_connection_state_changed) self.notification_center.close_requested.connect( self.close_notification_center) # self.notification_center.add_notification( # "ERROR", "An error message to test how it looks like." # ) # self.notification_center.add_notification( # "WARNING", "Another message but this time its a warning." # ) # self.notification_center.add_notification( # "INFO", "An information message, because we gotta test them all." # ) # self.notification_center.add_notification( # "ERROR", # "And another error message, but this one will be a little bit longer just " # "to see if the GUI can handle it.", # ) self.reset()
def __init__(self, workspace_fs): # Initialize UI super().__init__() self.setupUi(self) # Read-only attributes self.workspace_fs = workspace_fs # Property inner state self._reencrypting = None self._reencryption_needs = None # Static initialization self.switch_button = SwitchButton() self.widget_actions.layout().insertWidget(0, self.switch_button) self.switch_button.clicked.connect(self._on_switch_clicked) self.setCursor(QCursor(Qt.PointingHandCursor)) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) if not self.timestamped: self.button_delete.hide() self.button_reencrypt.hide() self.widget_empty.layout().addWidget(EmptyWorkspaceWidget()) else: self.switch_button.setChecked(True) self.button_reencrypt.hide() self.button_remount_ts.hide() self.button_share.hide() self.button_rename.hide() self.label_shared.hide() self.label_owner.hide() self.switch_button.hide() widget_tmp = TemporaryWorkspaceWidget() self.widget_empty.layout().addWidget(widget_tmp) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect) self.widget_reencryption.hide() self.button_share.clicked.connect(self.button_share_clicked) self.button_share.apply_style() self.button_reencrypt.clicked.connect(self.button_reencrypt_clicked) self.button_reencrypt.apply_style() self.button_delete.clicked.connect(self.button_delete_clicked) self.button_delete.apply_style() self.button_rename.clicked.connect(self.button_rename_clicked) self.button_rename.apply_style() self.button_remount_ts.clicked.connect(self.button_remount_ts_clicked) self.button_remount_ts.apply_style() self.button_open.clicked.connect(self.button_open_workspace_clicked) self.button_open.apply_style() self.label_owner.apply_style() self.label_shared.apply_style()
class SplashScreen(QMainWindow): """SpalshScreen-ul de inceput""" def __init__(self): QMainWindow.__init__(self) self.main_win = MainWindow() self.ui = Ui_SplashScreen() self.ui.setupUi(self) # REMOVE TITLE BAR self.setWindowFlag(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) # DROP SHADOW EFFECT self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(40) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) # INITIAL TEXT self.ui.label_loading.setText("loading...") # CHANGE LOADING DOTS QTimer.singleShot(750, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(1500, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(2250, lambda: self.ui.label_loading.setText("loading...")) QTimer.singleShot(3000, lambda: self.ui.label_loading.setText("loading.")) QTimer.singleShot(3750, lambda: self.ui.label_loading.setText("loading..")) QTimer.singleShot(4500, lambda: self.ui.label_loading.setText("loading...")) # PROGRESS BAR TIMER self.time = QTimer() self.time.timeout.connect(self.progress) self.time.start(35) self.show() def progress(self): global counter # UPDATE PROGRESS BAR self.ui.progressBar.setValue(counter) # STOP THE TIMER if counter > 100: self.time.stop() self.main_win.show() self.close() counter += 5
def __init__(self, core, jobs_ctx, event_bus, **kwargs): super().__init__(**kwargs) self.setupUi(self) self.jobs_ctx = jobs_ctx self.core = core self.event_bus = event_bus self.menu = MenuWidget(parent=self) self.widget_menu.layout().addWidget(self.menu) for e in self.NOTIFICATION_EVENTS: self.event_bus.connect(e, self.handle_event) self.label_mountpoint.setText(str(self.core.config.mountpoint_base_dir)) self.label_mountpoint.clicked.connect(self.open_mountpoint) self.menu.organization = self.core.device.organization_addr.organization_id self.menu.username = self.core.device.user_id self.menu.device = self.core.device.device_name self.menu.organization_url = str(self.core.device.organization_addr) self.new_notification.connect(self.on_new_notification) self.menu.files_clicked.connect(self.show_mount_widget) self.menu.users_clicked.connect(self.show_users_widget) self.menu.devices_clicked.connect(self.show_devices_widget) self.menu.logout_clicked.connect(self.logout_requested.emit) self.connection_state_changed.connect(self._on_connection_state_changed) self.widget_title2.hide() self.widget_title3.hide() self.title2_icon.apply_style() self.title3_icon.apply_style() self.icon_mountpoint.apply_style() effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(100, 100, 100)) effect.setBlurRadius(4) effect.setXOffset(-2) effect.setYOffset(2) self.widget_notif.setGraphicsEffect(effect) self.mount_widget = MountWidget(self.core, self.jobs_ctx, self.event_bus, parent=self) self.widget_central.layout().insertWidget(0, self.mount_widget) self.mount_widget.folder_changed.connect(self._on_folder_changed) self.users_widget = UsersWidget(self.core, self.jobs_ctx, self.event_bus, parent=self) self.widget_central.layout().insertWidget(0, self.users_widget) self.devices_widget = DevicesWidget(self.core, self.jobs_ctx, self.event_bus, parent=self) self.widget_central.layout().insertWidget(0, self.devices_widget) self._on_connection_state_changed( self.core.backend_conn.status, self.core.backend_conn.status_exc ) self.show_mount_widget()
def get_shadow(): """ Returns shadow effect. """ shadow = QGraphicsDropShadowEffect() shadow.setBlurRadius(10) shadow.setXOffset(0) shadow.setYOffset(0) return shadow
def get_shadow(): """ Returns shadow effect. """ shadow = QGraphicsDropShadowEffect() shadow.setBlurRadius(10) shadow.setXOffset(0) shadow.setYOffset(0) return shadow
def init_effects(root_window: QWidget) -> QGraphicsDropShadowEffect: """ Initialize base effects :return: QGraphicsDropShadowEffect """ # ------------------------------ EFFECTS ------------------------------------------ effect = QGraphicsDropShadowEffect(root_window) effect.setXOffset(0) effect.setYOffset(0) effect.setBlurRadius(10) effect.setColor(QColor("#b4b4b4")) return effect
def replay_movie(self, _, event: QEvent): key_event = QKeyEvent(event) if key_event.type( ) == QKeyEvent.KeyPress and not key_event.isAutoRepeat(): self.movie.stop() self.movie.start() effect = QGraphicsDropShadowEffect() effect.setBlurRadius(20) effect.setXOffset(0) effect.setYOffset(0) effect.setColor(Qt.red) self.gif_progress_bar.setGraphicsEffect(effect) if key_event.type() == QKeyEvent.KeyRelease: self.gif_progress_bar.setGraphicsEffect(None)
def eventFilter(self, object, event): if event.type() == QEvent.Enter: radius = 20 elif event.type() == QEvent.Leave: radius = 0 else: return False shadow = QGraphicsDropShadowEffect(self, blurRadius=radius, color=QColor(255,255,255), offset=QPointF(0, 0)) shadow.setXOffset(0) shadow.setYOffset(0) self.setGraphicsEffect(shadow) return True
class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): TextBr = QTextBrowser(self) TextBr.setGeometry(400, 300, 300, 100) TextBr.setText('Test') rbtn = QPushButton('Red', self) rbtn.setObjectName("Red") rbtn.setGeometry(10, 30, 50, 50) gbtn = QPushButton('Green', self) gbtn.setObjectName("Green") gbtn.setGeometry(10, 90, 50, 50) bbtn = QPushButton('Blue', self) bbtn.setObjectName("Blue") bbtn.setGeometry(10, 160, 50, 50) frm = QFrame(self) frm.setGeometry(200, 50, 500, 500) frm.setObjectName("frame1") frm2 = QFrame(self) frm2.setGeometry(100, 100, 100, 100) frm2.setObjectName("frame2") self.setGeometry(300, 200, 1000, 500) self.setWindowTitle('QSS learning') # self.setStyleSheet('QPushButton{background-color:rgb(0,255,0)}') self.setStyleSheet( '#frame1{background-color:rgb(0,255,0)}' '#frame1:hover{background-color:rgb(0,255,235)}' '#frame2{background-color:rgb(0,255,0);border-radius:15px;}' '#Red{background-color:rgb(128,0,0);border-radius:5px;}' '#Red:hover{background-color:rgb(255,125,125);border-radius:25px;}' '#Red:pressed {background-color:rgb(255,125,125)}') self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(50) self.shadow.setXOffset(2) self.shadow.setYOffset(5) self.shadow.setColor(QColor(0, 0, 0, 255)) frm2.setGraphicsEffect(self.shadow) self.show()
class ChildButtonsetted(QWidget): # 覆盖图层 child_widget_signal = pyqtSignal(int) #带一个参数(字典)的信号 def __init__(self, parent=None): super(ChildButtonsetted, self).__init__(parent) self.shadow = QGraphicsDropShadowEffect() self.shadow.setBlurRadius(200) self.shadow.setColor(QColor(85, 123, 182)) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow2 = QGraphicsDropShadowEffect() self.shadow2.setBlurRadius(5) self.shadow2.setXOffset(5) self.shadow2.setYOffset(5) self.setGraphicsEffect(self.shadow2) self.resize(340,640) self.wdt = QWidget() #self.wdt.setAttribute(Qt.WA_TranslucentBackground) self.wdt.setObjectName("tipWaitingWindow_back") self.wdt.setStyleSheet("#tipWaitingWindow_back{background:rgba(0,0,0,0.2)}") self.layout = QGridLayout(self) self.layout.addWidget(self.wdt) self.layout.setContentsMargins(10, 10, 10, 10) self.layout.setSpacing(10) #self.main_layout = QGridLayout(self) self.main_layout = QVBoxLayout(self) self.wdt.setLayout(self.main_layout) self.webEngineView = QWebEngineView() self.webEngineView.load(QUrl('file:///C://Users/admin/Desktop/college/senior/VE450/page_simple_layoutnew.html')) #self.webEngineView2.load(QUrl('file:///C://Users/admin/Desktop/college/senior/VE450/timeline_bar(1).html')) #self.webEngineView3.load(QUrl('file:///C://Users/admin/Desktop/college/senior/VE450/gauge.html')) #self.webEngineView4.load(QtCore.QUrl('timeline_bar(1).html')) #self.main_layout.addWidget(self.webEngineView,4,0,4,3) #self.main_layout.addWidget(self.webEngineView2,4,3,4,3) #self.main_layout.addWidget(self.webEngineView3,8,0,4,3) self.main_layout.addWidget(self.webEngineView) #self.main_layout.addWidget(self.webEngineView2) #self.main_layout.addWidget(self.webEngineView3) #self.main_layout.addWidget(self.webEngineView4,8,3,4,3) def slot_next_btn_func(self): self.child_widget_signal.emit(1)
def add_button(self): self.pushButton = QtWidgets.QPushButton(self) self.pushButton.setObjectName('error_dialog_okButton') self.pushButton.setGeometry(QtCore.QRect(0, 0, 100, 30)) self.move_to_center( self.pushButton, self, 0, round(self.size().height() / 2 - self.pushButton.frameSize().height() / 2 - 20)) self.pushButton.setText("OK") self.pushButton.clicked.connect(self.close_dlg) self.pushButton.installEventFilter(self) shadow_effect = QGraphicsDropShadowEffect(self.pushButton) shadow_effect.setColor(QColor(0, 0, 0, 127)) shadow_effect.setYOffset(0) shadow_effect.setXOffset(6) shadow_effect.setBlurRadius(12) # shadow_effect.setEnabled(True) self.pushButton.setGraphicsEffect(shadow_effect)
class SplashScreen(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_SplashScreen() self.ui.setupUi(self) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.shadow = QGraphicsDropShadowEffect(self) self.shadow.setBlurRadius(20) self.shadow.setXOffset(0) self.shadow.setYOffset(0) self.shadow.setColor(QColor(0, 0, 0, 60)) self.ui.dropShadowFrame.setGraphicsEffect(self.shadow) self.timer = QtCore.QTimer() self.timer.timeout.connect(self.progress) self.timer.start(35) self.ui.label_description.setText( "<strong>Welcome</strong> to my Application") QtCore.QTimer.singleShot( 1500, lambda: self.ui.label_description.setText( "<strong>Loading</strong> Database")) QtCore.QTimer.singleShot( 3000, lambda: self.ui.label_description.setText( "<strong>Loading</strong> User Interface")) QtCore.QTimer.singleShot self.show() def progress(self): global counter self.ui.progressBar.setValue(counter) if counter > 100: self.timer.stop() self.main = MainWindow() self.main.show() self.close() counter += 4
def __init__(self, device_name, is_current_device, certified_on): super().__init__() self.setupUi(self) self.is_current_device = is_current_device self.label_icon.apply_style() self.device_name = device_name self.certified_on = certified_on self.label_device_name.setText(self.device_name) if self.is_current_device: self.label_is_current.setText("({})".format( _("TEXT_DEVICE_IS_CURRENT"))) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def __init__(self: "MainWindow", *args: Iterable[Any], returnPressedHandler: Callable[["MainWindow", str], None], textChangedHandler: Callable[["MainWindow", str], None], keyPressedHandler: Callable[["MainWindow", Qt.Key], bool], **kwargs: Mapping[str, Any]) -> None: super().__init__(*args, **kwargs) self.setWindowTitle("Launcher") self.returnPressedHandler = returnPressedHandler self.textChangedHandler = textChangedHandler self.keyPressedHandler = keyPressedHandler self.setObjectName("window") self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setAttribute(Qt.WA_TranslucentBackground) self.moveToCenter() effect = QGraphicsDropShadowEffect() effect.setBlurRadius(20) effect.setColor(QColor(0, 0, 0, 192)) effect.setXOffset(0) effect.setYOffset(3) self.setGraphicsEffect(effect) self.windowLayout = QVBoxLayout(self) self.windowLayout.setSizeConstraint(QLayout.SetFixedSize) self.windowLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.windowLayout) self.createFrame() self.createInput() self.createTextResult() self.createImageResult() self.createErrorResult() self.createBashResult() self.createListResult() self.currentResult: Optional[QWidget] = None self.input.textChanged.connect(self.onTextChange) self.input.returnPressed.connect(self.onReturnPressed) self.setStyleSheet(style_sheet)
def __init__(self, user_info, is_current_user, current_user_is_admin): super().__init__() self.setupUi(self) self.user_info = user_info self.is_current_user = is_current_user self.current_user_is_admin = current_user_is_admin if self.is_current_user: self.label_is_current.setText("({})".format(_("TEXT_USER_IS_CURRENT"))) self.label_icon.apply_style() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def __init__(self, parent, title="Title", width=500, height=180): self.parent = parent super().__init__(parent) self.setWindowFlags(Qt.FramelessWindowHint) # Dialog Shadow if not self.NO_SHADOW: self.setAttribute(Qt.WA_TranslucentBackground) effect = QGraphicsDropShadowEffect() effect.setBlurRadius(15) effect.setXOffset(0) effect.setYOffset(0) self.setGraphicsEffect(effect) self.center(width, height) self.setContentsMargins(0, 0, 0, 0) self.setAcceptDrops(True) layout = QVBoxLayout() layout.setSpacing(0) layout.setAlignment(Qt.AlignTop) layout.setContentsMargins(0, 0, 0, 0) # Title title = QLabel(title) title.setObjectName('title') def trigger_close(_): self.close() close_btn = Builder().text('x').name('close_btn').click(trigger_close).build() header = QHBoxLayout() header.addWidget(title) header.addStretch(1) header.addWidget(close_btn) dlgHeader = QFrame() dlgHeader.setObjectName('header') dlgHeader.setLayout(header) layout.addWidget(dlgHeader) widget = QWidget(self) self.main = self.ui(widget) widget.setObjectName('main') widget.setLayout(self.main) layout.addWidget(widget) self.setLayout(layout) self.setStyleSheet(self.style())
def contar_apps(self): global selected_apps cuenta = len(selected_apps) if cuenta == 0: texto = "Seleccione las aplicaciones a instalar" self.ui.btn_install.setEnabled(False) borde = "border: 2px solid rgb(45, 45, 45);" r, g, b = 255, 255, 255 else: self.ui.btn_install.setEnabled(True) borde = "border: 2px solid #419fd9;" r, g, b = 0, 255, 255 if cuenta != 1: acentuacion, articulo, plural = "o", "es", "s" else: acentuacion, articulo, plural = "ó", "", "" texto = "{} aplicaci{}n{} seleccionada{} para instalar".format( cuenta, acentuacion, articulo, plural) estilo = ("#btn_install{\n" "color: #fff;\n" "padding: 2px;\n" "border-radius: 5px;\n" "background-color: rgb(45, 45, 45);\n" + borde + "}\n" "#btn_install:hover{\n" "padding: 2px;\n" "color:white;\n" "background-color: rgb(65, 159, 217);\n" "border: 1px solid rgb(142, 231, 255);\n" "border-radius: 5px;\n" "}") self.ui.btn_install.setStyleSheet(estilo) shadow = QGraphicsDropShadowEffect(self, blurRadius=10, color=QColor(r, g, b), offset=QPointF(0, 0)) shadow.setXOffset(0) shadow.setYOffset(0) self.ui.btn_install.setGraphicsEffect(shadow) self.ui.lbl_list_apps.setText(texto)
def __init__(self, device_info, is_current_device): super().__init__() self.setupUi(self) self.is_current_device = is_current_device self.device_info = device_info self.label_icon.apply_style() self.label_device_name.setText( ensure_string_size(self.device_info.device_display, 260, self.label_device_name.font())) self.label_device_name.setToolTip(self.device_info.device_display) if self.is_current_device: self.label_is_current.setText("({})".format( _("TEXT_DEVICE_IS_CURRENT"))) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def __init__(self, email, addr): super().__init__() self.setupUi(self) self.addr = addr self.email = email self.label_email.setText( ensure_string_size(self.email, 260, self.label_email.font())) self.label_email.setToolTip(self.email) self.button_greet.clicked.connect(self._on_greet_clicked) self.button_cancel.clicked.connect(self._on_cancel_clicked) self.button_cancel.apply_style() self.label_icon.apply_style() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) effect = QGraphicsDropShadowEffect(self) effect.setColor(QColor(0x99, 0x99, 0x99)) effect.setBlurRadius(10) effect.setXOffset(2) effect.setYOffset(2) self.setGraphicsEffect(effect)
def init_ui(self): box = QHBoxLayout() self.list = CustomList() self.list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) self.list.setSelectionMode(CustomList.SingleSelection) self.train_item = QListWidgetItem("Training") self.train_item.setTextAlignment(QtCore.Qt.AlignCenter) self.test_item = QListWidgetItem("Testing") self.test_item.setTextAlignment(QtCore.Qt.AlignCenter) self.list.addItem(self.train_item) self.list.addItem(self.test_item) self.list.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.list.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) shadow = QGraphicsDropShadowEffect() shadow.setColor(QColor(179, 179, 179, 40).darker(800)) shadow.setXOffset(1) shadow.setYOffset(0) self.list.setGraphicsEffect(shadow) self.list.setCurrentRow(0) self.stack = QStackedLayout() self.training_widget = TrainingWidget() self.training_widget.training.connect(self.handle_training) self.testing_widget = TestingWidget() self.stack.addWidget(self.training_widget) self.stack.addWidget(self.testing_widget) self.list.currentRowChanged.connect(self.stack.setCurrentIndex) box.setSpacing(70) box.addWidget(self.list) box.addLayout(self.stack) self.setLayout(box) self.setObjectName("main") self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setWindowFlags(QtCore.Qt.Widget | QtCore.Qt.MSWindowsFixedSizeDialogHint) self.layout().setContentsMargins(0, 0, 0, 0) self.setWindowTitle('Demo') self.show()