def __init__(self, main): QFrame.__init__(self) self.setupUi(self) self.main = main self.table_size: list = [6, 5] self.spinBox_row.setValue(self.table_size[0]) self.spinBox_col.setValue(self.table_size[1]) self.start = [1, 1] self.end = [5, 4] self.obstacles = [[1, 3] ] # 2D list like [[1, 2], [3, 4]] to show obstacles self.radio = "" self.connect(self.spinBox_col, SIGNAL("valueChanged(int)"), self.set_col) self.connect(self.spinBox_row, SIGNAL("valueChanged(int)"), self.set_row) self.connect(self.pushButtonGenerate, SIGNAL("clicked()"), self.generate_table) self.connect(self.pushButtonResult, SIGNAL("clicked()"), self.run) self.radioButtonInit.toggled.connect( lambda: self.radio_change(self.radioButtonInit)) self.radioButtonGoal.toggled.connect( lambda: self.radio_change(self.radioButtonGoal)) self.radioButtonObstacles.toggled.connect( lambda: self.radio_change(self.radioButtonObstacles)) # TODO: edit cell self.connect(self.tableWidgetResult, SIGNAL("cellClicked(int, int)"), self.on_click_cell) self.generate_table()
def __init__(self, cp: ControlPoint, game_model: GameModel) -> None: QFrame.__init__(self) self.cp = cp self.game_model = game_model self.deliveryEvent: Optional[UnitsDeliveryEvent] = None self.bought_amount_labels = {} self.existing_units_labels = {} for event in self.game_model.game.events: if event.__class__ == UnitsDeliveryEvent and event.from_cp == self.cp: self.deliveryEvent = event if not self.deliveryEvent: self.deliveryEvent = self.game_model.game.units_delivery_event( self.cp) # Determine maximum number of aircrafts that can be bought self.set_maximum_units(self.cp.available_aircraft_slots) self.set_recruitable_types([CAP, CAS]) self.bought_amount_labels = {} self.existing_units_labels = {} self.hangar_status = QHangarStatus(self.total_units, self.cp.available_aircraft_slots) self.init_ui()
def __init__(self, parent=None): QFrame.__init__(self, parent) self.m_mouse_down = False self.setFrameShape(QFrame.StyledPanel) css = """ QFrame{ Background: #212121; color:white; font: 12pt "Roboto"; font-weight:bold; } """ self.setStyleSheet(css) self.setWindowFlags(Qt.FramelessWindowHint) self.setMouseTracking(True) self.m_titleBar = TitleBar() self.m_content = QWidget(self) vbox = QVBoxLayout(self) vbox.addWidget(self.m_titleBar) vbox.setMargin(0) vbox.setSpacing(0) layout = QVBoxLayout(self) layout.addWidget(self.m_content) layout.setMargin(5) layout.setSpacing(0) vbox.addLayout(layout) self.widgets()
def __init__(self, main): QFrame.__init__(self) self.setupUi(self) self.main = main self.edge = 3 self.spinBoxEdge.setValue(self.edge) self.connect(self.spinBoxEdge, SIGNAL("valueChanged(int)"), self.set_edge) self.connect(self.pushButtonCommit, SIGNAL("clicked()"), self.run)
def __init__(self, cp: ControlPoint, game_model: GameModel): QFrame.__init__(self) self.cp = cp self.game_model = game_model self.bought_amount_labels = {} self.existing_units_labels = {} self.init_ui()
def __init__(self, controller): QFrame.__init__(self) self.game = controller self.mine_image = QPixmap("images/mine.png") self.mine_red_image = QPixmap("images/mine_red.png") self.flag_image = QPixmap("images/flag.png") self.cell_raised_image = QPixmap("images/cell_raised.png") controller.gameReset.connect(self.repaint) self.reset()
def __init__(self, *args, **kwargs): self.pressedDown = False self.clicked = lambda: None QFrame.__init__(self, *args, **kwargs) self.setFrameShadow(QFrame.Raised) self._text = QLabel(parent=self) self._text.setGeometry(1, 1, self.size().width() - 2, self.size().height() - 2) pass
def __init__(self, alignment_info): """ Constructor :param alignment_info: the alignment information """ QFrame.__init__(self) if not isinstance(alignment_info, AlignmentInfo): raise TypeError( "BarFrameStacker requires an AlignmentInfo. You provided a " + str(type(alignment_info))) self.__alignmentInfo = alignment_info self.__sequenceLength = alignment_info.getRefInfo().getSeqPaddedLen() self.__bioFrames = [] # Make the display components for the reference sequence bar_frame_ref = BarFrame(alignment_info.getRefInfo()) nucleotide_frame_ref = NucleotideFrame(alignment_info.getRefInfo()) # Align text to bottom so that the text is close to the bar frame (since the nucleotide frame goes above it) nucleotide_frame_ref.setVerticalTextAlignment(Qt.AlignBottom) # Make the display components for the read sequence bar_frame_read = BarFrame(alignment_info.getReadInfo()) nucleotide_frame_read = NucleotideFrame(alignment_info.getReadInfo()) # Align text to top so that the text is close to the bar frame (since the nucleotide frame goes below it) nucleotide_frame_read.setVerticalTextAlignment(Qt.AlignTop) # This is what the display is going to look like self.__bioFrames.append(nucleotide_frame_ref) self.__bioFrames.append(bar_frame_ref) self.__bioFrames.append(bar_frame_read) self.__bioFrames.append(nucleotide_frame_read) box_layout = QVBoxLayout() box_layout.setAlignment(Qt.AlignTop) # Count the minimum and max hieghts of our sub components to determine our min and max heights min_height = 20 max_height = 2 min_width = 10 # No max width; this thing can get wide for subcomponent in self.__bioFrames: min_height += subcomponent.minimumHeight() + 2 max_height += subcomponent.maximumHeight() + 2 min_width = max(min_width, subcomponent.minimumWidth()) # Add widget to the layout box_layout.addWidget(subcomponent, stretch=0) self.setMaximumHeight(max_height) self.setMinimumSize(min_width, min_height) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.setLayout(box_layout)
def __init__(self, controller): QFrame.__init__(self) self.controller = controller self.controller.flagsCountChanged.connect(self.update_flags_count) self.controller.gameReset.connect(self.reset_timer) self.timer_val = 0 self.timer = QTimer() self.timer.timeout.connect(self.increment_timer) self.timer.start(1000) self.flags = QLabel("0") self.flags.setFixedWidth(50) self.flags.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.flags.setAutoFillBackground(True) flagsFont = self.flags.font() flagsFont.setPixelSize(28) self.flags.setFont(flagsFont) flagsPalette = self.flags.palette() flagsPalette.setColor(QPalette.Foreground, Qt.red) flagsPalette.setColor(QPalette.Window, Qt.black) self.flags.setPalette(flagsPalette) self.reset = QPushButton() self.reset.setFixedSize(45, 45) self.reset.clicked.connect(self.restart_game) self.seconds = QLabel("0") self.seconds.setFixedWidth(50) self.seconds.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.seconds.setAutoFillBackground(True) secondsFont = self.seconds.font() secondsFont.setPixelSize(28) self.seconds.setFont(secondsFont) secondsPalette = self.seconds.palette() secondsPalette.setColor(QPalette.Foreground, Qt.red) secondsPalette.setColor(QPalette.Window, Qt.black) self.seconds.setPalette(secondsPalette) self.layout = QHBoxLayout() self.layout.setContentsMargins(5, 0, 5, 0) self.layout.setSpacing(0) self.layout.addWidget(self.flags) self.layout.addSpacerItem(QSpacerItem(100, 10, QSizePolicy.Maximum)) self.layout.addWidget(self.reset) self.layout.addSpacerItem(QSpacerItem(100, 10, QSizePolicy.Maximum)) self.layout.addWidget(self.seconds) self.setLayout(self.layout)
def __init__(self, widget): QFrame.__init__(self, widget) self.setGeometry(QRect(0, 0, 800, 480)) self.setStyleSheet( "font: 24pt 배달의민족 주아;" "background-color: rgba(0, 0, 0, 100);" ) self.dialog = QFrame(self) self.dialog.setGeometry(QRect(200, 120, 400, 240)) self.dialog.setStyleSheet("background-color: white;" "border-radius: 25px;")
def __init__(self, cp: ControlPoint, game_model: GameModel) -> None: QFrame.__init__(self) self.cp = cp self.game_model = game_model self.purchase_groups = {} self.bought_amount_labels = {} self.existing_units_labels = {} # Determine maximum number of aircrafts that can be bought self.set_maximum_units(self.cp.total_aircraft_parking) self.bought_amount_labels = {} self.existing_units_labels = {} self.hangar_status = QHangarStatus(game_model, self.cp) main_layout = QVBoxLayout() scroll_content = QWidget() task_box_layout = QGridLayout() row = 0 unit_types: Set[AircraftType] = set() for unit_type in self.game_model.game.player_faction.aircrafts: if self.cp.is_carrier and not unit_type.carrier_capable: continue if self.cp.is_lha and not unit_type.lha_capable: continue if (self.cp.cptype in [ControlPointType.FOB, ControlPointType.FARP] and unit_type not in helicopter_map.values()): continue unit_types.add(unit_type) sorted_units = sorted( unit_types, key=lambda u: u.name, ) for row, unit_type in enumerate(sorted_units): self.add_purchase_row(unit_type, task_box_layout, row) stretch = QVBoxLayout() stretch.addStretch() task_box_layout.addLayout(stretch, row, 0) scroll_content.setLayout(task_box_layout) scroll = QScrollArea() scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) scroll.setWidgetResizable(True) scroll.setWidget(scroll_content) main_layout.addLayout(self.hangar_status) main_layout.addWidget(scroll) self.setLayout(main_layout)
def __init__(self, alignment_info_list: List[AlignmentInfo]): """ Once complete CompleteComparisonFrame is made per AlignmentInfo :param alignment_info_list: A list of AlignmentInfos to display """ QFrame.__init__(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) box_layout = QVBoxLayout() for alignment_info in alignment_info_list: comparison_frame = CompleteComparisonFrame(alignment_info) box_layout.addWidget(comparison_frame) self.setLayout(box_layout)
def __init__(self, alignment_info: AlignmentInfo): """ Constructor :param alignment_info: The AlignmentInfo to Display """ QFrame.__init__(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) title_label = QLabel(alignment_info.getName()) title_label.setFont(QFont("SansSerif", 16)) title_label.setAlignment(Qt.AlignCenter) title_label.setMinimumHeight(20) stacker = BarFrameStacker(alignment_info) scroll_thing = BarFrameStackerScrollArea(stacker) zoom_thing = ZoomButtons(scroll_thing.zoomIn, scroll_thing.zoomOut) scroll_button_thing = ScrollButtons(scroll_thing.scroll_start, scroll_thing.scroll_backward, scroll_thing.scroll_forward, scroll_thing.scroll_end) blank_space = QFrame() all_the_buttons = QFrame() button_layout = QHBoxLayout() button_layout.addWidget(zoom_thing, stretch=1) button_layout.addWidget(blank_space) button_layout.addWidget(scroll_button_thing, stretch=2) all_the_buttons.setLayout(button_layout) box_layout3 = QVBoxLayout() box_layout3.addWidget(title_label) box_layout3.addWidget(scroll_thing, stretch=1) box_layout3.addWidget(all_the_buttons, stretch=1) self.setLayout(box_layout3) # The below is a very bad way to appropriately size the bar graph on initialization # This zooms in until you can't zoom in anymore # TODO - Make a nicer way to do this prev_zoom_level = 0 while scroll_thing.getCurrentZoomLevel() != prev_zoom_level: prev_zoom_level = scroll_thing.getCurrentZoomLevel() scroll_thing.zoomIn() # This zooms out until you can't zoom out anymore # This will not zoom out more than it should prev_zoom_level = 0 while scroll_thing.getCurrentZoomLevel() != prev_zoom_level: prev_zoom_level = scroll_thing.getCurrentZoomLevel() scroll_thing.zoomOut()
def __init__(self, cp: ControlPoint, game: Game): QFrame.__init__(self) self.cp = cp self.game = game self.bought_amount_labels = {} self.existing_units_labels = {} for event in self.game.events: if event.__class__ == UnitsDeliveryEvent and event.from_cp == self.cp: self.deliveryEvent = event if not self.deliveryEvent: self.deliveryEvent = self.game.units_delivery_event(self.cp) self.init_ui()
def __init__(self, half_alignment_info): """ This is a constructor :param half_alignment_info: Contains enough information to draw one nucleotide sequence """ QFrame.__init__(self) if not isinstance(half_alignment_info, HalfAlignmentInfo): raise TypeError( "NucleotideFrame requires a HalfAlignmentInfo. You provided a " + str(type(half_alignment_info))) self.__alignmentInfo = half_alignment_info # The height and size of the bar is set in pixels self.setMaximumHeight(25) self.setMinimumSize(0, 25)
def __init__(self, main): QFrame.__init__(self) self.setupUi(self) self.main = main self.people = 9 self.starter = 1 self.times = 5 self.spinBox_times.setValue(self.times) self.spinBox_starter.setValue(self.starter) self.spinBox_people.setValue(self.people) self.connect(self.spinBox_people, SIGNAL("valueChanged(int)"), self.set_people) self.connect(self.spinBox_starter, SIGNAL("valueChanged(int)"), self.set_starter) self.connect(self.spinBox_times, SIGNAL("valueChanged(int)"), self.set_times) self.connect(self.commitButton, SIGNAL("clicked()"), self.run)
def __init__(self, cp: ControlPoint, game_model: GameModel) -> None: QFrame.__init__(self) self.cp = cp self.game_model = game_model self.bought_amount_labels = {} self.existing_units_labels = {} # Determine maximum number of aircrafts that can be bought self.set_maximum_units(self.cp.total_aircraft_parking) self.set_recruitable_types([CAP, CAS]) self.bought_amount_labels = {} self.existing_units_labels = {} self.hangar_status = QHangarStatus(game_model, self.cp) self.init_ui()
def __init__(self): QFrame.__init__(self) self.setMouseTracking(True) self.dx = 0 self.dy = 0 self.m_width = self.width() self.m_height = self.height() self.complete = 1 self.Channel1PaintList = [] self.Channel1PaintList2 = [] self.Channel2PaintList = [] self.Channel2PaintList2 = [] self.Channel1PaintListLen = 0 self.Channel2PaintListLen = 0 self.unit = 0 self.m_DragPosition = 0 self.period = 0 logging.debug("CanvasFrame:" + str(self.m_width) + "+" + str(self.m_height))
def __init__(self, parent=None): QFrame.__init__(self, parent) palette = QPalette() pixmap = QPixmap("sec_shield.png") brush = QBrush(pixmap) frame_layout = QVBoxLayout() self.setFixedSize(300, 300) self.setFrameStyle(QFrame.Box) self.setWindowTitle("QFrame Set Background Image Example") #set QFrame Border Width 4 pixels self.setLineWidth(4) self.setLayout(frame_layout) btn1 = QPushButton(self) btn1.setText("Button 1") frame_layout.addWidget(btn1) palette.setBrush(QPalette.Background, brush) self.setPalette(palette)
def __init__(self, app): QFrame.__init__(self) self.app = app self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.path = QLineEdit("") self.scan = QLineEdit("") self.slice = QLabel("") info = QFrame() info.setLayout(QFormLayout()) info.layout().addRow("Path:", self.path) info.layout().addRow("Scan:", self.scan) info.layout().addRow("Slice:", self.slice) self.layout().addWidget(info) self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) self.updateGeometry()
def __init__(self, width, height, config): """ Custom widget for the execution frame's status bar :param width: to use as width for this label :type width: int :param height: to use as height for this label :type height: int :param config: configuration file """ QFrame.__init__(self) self.setFixedSize(width, height) self.config = config self.label = QLabel() self.progressbar = QProgressBar() self.label.setFixedSize(width, height - 5) self.progressbar.setFixedSize(width, 5) self.progressbar.setRange(0, PROGRESS_BAR_MAX) self.progressbar.setValue(100) self.progressbar.setTextVisible(False) self._set_style_sheet() layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.label) layout.addWidget(self.progressbar) self.setLayout(layout) self.last_thread = 0 self.sig_progress_bar.connect(self.__set_progress_val) self.sig_persistent_message.connect(self.__set_status_message) self.sig_temp_message.connect(self.__display_temporary_message)
def __init__(self, start_function, backward_function, forward_function, end_function): """ Constructor :param start_function: the function called when the "<<" button is clicked :param backward_function: the function called when the "<" button is clicked :param forward_function: the function called when the ">" button is clicked :param end_function: the function called when the ">>" button is clicked """ QFrame.__init__(self) button_start = QPushButton() button_start.clicked.connect(start_function) button_start.setText("<<") button_backward = QPushButton() button_backward.clicked.connect(backward_function) button_backward.setText("<") button_forward = QPushButton() button_forward.clicked.connect(forward_function) button_forward.setText(">") button_end = QPushButton() button_end.clicked.connect(end_function) button_end.setText(">>") box_layout2 = QHBoxLayout() box_layout2.addWidget(button_start) box_layout2.addWidget(button_backward) box_layout2.addWidget(button_forward) box_layout2.addWidget(button_end) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setMinimumSize(140, 20) self.setMaximumSize(300, 50) self.resize(200, 30) self.setLayout(box_layout2)
def __init__(self, readImg): QFrame.__init__(self) self._readImg = weakref.ref(readImg) self.graphicsView = QtWidgets.QGraphicsView(self) self.graphicsView.setTransformationAnchor( self.graphicsView.AnchorUnderMouse) self.graphicsView.setResizeAnchor(self.graphicsView.AnchorUnderMouse) self.graphicsView.setFrameStyle(QFrame.NoFrame) self.graphicsView.setObjectName("graphicsView") self.qtTool = QtImgTool(self) self.graphicsView.setBackgroundBrush(QColor(Qt.white)) self.graphicsView.setCursor(Qt.OpenHandCursor) self.graphicsView.setResizeAnchor(self.graphicsView.AnchorViewCenter) self.graphicsView.setTransformationAnchor( self.graphicsView.AnchorViewCenter) self.graphicsView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graphicsView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graphicsView.setRenderHints(QPainter.Antialiasing | QPainter.HighQualityAntialiasing | QPainter.SmoothPixmapTransform) self.graphicsView.setCacheMode(self.graphicsView.CacheBackground) self.graphicsView.setViewportUpdateMode( self.graphicsView.SmartViewportUpdate) self.graphicsItem = QGraphicsPixmapItem() self.graphicsItem.setFlags(QGraphicsPixmapItem.ItemIsFocusable | QGraphicsPixmapItem.ItemIsMovable) self.graphicsScene = QGraphicsScene(self) # 场景 self.graphicsView.setScene(self.graphicsScene) self.graphicsScene.addItem(self.graphicsItem) self.graphicsView.setMinimumSize(10, 10) self.graphicsView.installEventFilter(self) self.graphicsView.setWindowFlag(Qt.FramelessWindowHint) self.pixMap = QPixmap() self.scaleCnt = 0
def __init__(self, zoom_in_function, zoom_out_function): """ Constructor :param zoom_in_function: the function called when the plus button is clicked :param zoom_out_function: the function called when the minus button is clicked """ QFrame.__init__(self) button_zoom_in = QPushButton() button_zoom_in.clicked.connect(zoom_in_function) button_zoom_in.setText("+") button_zoom_out = QPushButton() button_zoom_out.clicked.connect(zoom_out_function) button_zoom_out.setText("-") box_layout2 = QHBoxLayout() box_layout2.addWidget(button_zoom_in) box_layout2.addWidget(button_zoom_out) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setMinimumSize(70, 20) self.setMaximumSize(150, 50) self.resize(100, 30) self.setLayout(box_layout2)
def __init__(self): QFrame.__init__(self) self.setFrameShape(self.VLine) self.setFrameStyle(self.Sunken)
def __init__(self): QFrame.__init__(self) self.setUp_GUI()
def __init__(self, name, link, is_done, price, xpath, time, is_monitoring, parent=None, shared_dict=None): QFrame.__init__(self, parent) self.shared_dict = shared_dict self.setMinimumSize(QSize(0, 300)) self.setStyleSheet("""QFrame{border-bottom: 0.5px solid #aaa;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self) # create description frame and layout self.frame_description = QFrame(self) self.frame_description.setMinimumSize(QSize(440, 16777215)) self.frame_description.setStyleSheet("""QFrame{border: none;}""") self.frame_description.setFrameShape(QFrame.StyledPanel) self.frame_description.setFrameShadow(QFrame.Raised) self.gridLayout_description = QGridLayout(self.frame_description) self.horizontalLayout.addWidget(self.frame_description) self.gridLayout_description.setColumnStretch(0, 1) self.gridLayout_description.setColumnStretch(1, 2) self.gridLayout_description.setColumnStretch(2, 3) self.gridLayout_description.setColumnStretch(3, 1) self.gridLayout_description.setColumnStretch(4, 6) # fill description layout self.label_name = QLabel(name, self.frame_description) self.label_name.setStyleSheet(styles.label_allegro_monitored_name) self.label_name.setTextFormat(Qt.MarkdownText) self.label_name.setAlignment(Qt.AlignJustify | Qt.AlignVCenter) self.label_name.setWordWrap(False) self.gridLayout_description.addWidget(self.label_name, 0, 0, 1, 5) self.url_link = "<a href=\"" + link + "\" style = \" color: #838836; text-decoration: none; font-family:corbel; title=\"Go to monitored page\"\">check product</a>" self.label_monitored_link = QLabel(url_link, self.frame_description) self.label_monitored_link.setStyleSheet(styles.label_allegro_monitored_link) self.gridLayout_description.addWidget(self.label_monitored_link, 1, 1, 2, 2) self.label_monitored_link.setOpenExternalLinks(True) self.label_stat = QLabel(self.frame_description) self.label_stat.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_stat, 1, 4, 1, 1) self.label_is_on = QLabel(self.frame_description) self.label_is_on.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_on, 5, 0, 1, 2) self.label_new_time = QLabel("Actual refresh time[s]: " + str(time)+" s", self.frame_description) self.label_new_time.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_time, 4, 0, 1, 3) self.lineEdit_new_time = QLineEdit(self.frame_description) self.lineEdit_new_time.setMinimumSize(QSize(0, 33)) self.lineEdit_new_time.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_time, 4, 3, 1, 2) self.lineEdit_new_time.setPlaceholderText("Set new interval") self.label_new_price = QLabel("Actual price: " + str(price), self) self.label_new_price.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_price, 3, 0, 1, 3) self.lineEdit_new_price = QLineEdit(self) self.lineEdit_new_price.setMinimumSize(QSize(0, 35)) self.lineEdit_new_price.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_price, 3, 3, 1, 2) self.lineEdit_new_price.setPlaceholderText("Set new price") self.label_img_link = QLabel(self.frame_description) self.label_img_link.setMaximumSize(QSize(20, 20)) self.label_img_link.setStyleSheet("""QLabel{border: none;}""") self.label_img_link.setPixmap(QPixmap(os.path.join(path, "img/link.png"))) self.label_img_link.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_link, 1, 0, 2, 1) self.label_img_stat = QLabel("done", self.frame_description) if is_done: self.label_stat.setText("done") self.label_img_stat.setPixmap(QPixmap(os.path.join(path, "img/check.png"))) else: self.label_stat.setText("in progress") self.label_img_stat.setPixmap(QPixmap(os.path.join(path, "img/loading.png"))) self.label_img_stat.setMaximumSize(QSize(20, 20)) self.label_img_stat.setStyleSheet("""QLabel{border: none;}""") self.label_img_stat.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_stat, 1, 3, 1, 1) self.label_img_monitor = QLabel("done", self.frame_description) if is_monitoring: monitor_text = "I am just monitoring" self.label_img_monitor.setPixmap(QPixmap(os.path.join(path, "img/monitoring.png"))) else: monitor_text = "I am going to buy" self.label_img_monitor.setPixmap(QPixmap(os.path.join(path, "img/buy.png"))) self.label_is_monitoring = QLabel(monitor_text, self) self.label_is_monitoring.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_monitoring, 2, 4, 1, 1) self.label_img_monitor.setMaximumSize(QSize(20, 20)) self.label_img_monitor.setStyleSheet("""QLabel{border: none;}""") self.label_img_monitor.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_monitor, 2, 3, 1, 1) # create spacer and delete btn self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.spacer) self.pushButton_delete = QPushButton(self) # self.pushButton_delete.clicked.connect( lambda: self.deleteLater()) self.pushButton_delete.clicked.connect(lambda: self.on_delete(link)) icon = QIcon() icon.addFile(os.path.join(path, "img/delete.png"), QSize(), QIcon.Selected, QIcon.Off) # icon.Active.addFile(os.path.join(path, "img/icon.png"), QSize(), QIcon.Selected, QIcon.Off) self.pushButton_delete.setIcon(icon) self.pushButton_delete.setIconSize(QSize(50, 50)) self.pushButton_delete.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_delete.setCursor(QCursor(Qt.PointingHandCursor)) # self.pushButton_delete.ico self.horizontalLayout.addWidget(self.pushButton_delete) self.is_on = data.get_switch_state(link) self.pushButton_switch = QPushButton(self) self.pushButton_switch.clicked.connect(lambda: self.on_switch(link)) self.icon_on = QIcon() self.icon_off = QIcon() self.icon_on.addFile(os.path.join(path, "img/switch_on.png"), QSize(), QIcon.Selected, QIcon.On) self.icon_off.addFile(os.path.join(path, "img/switch_off.png"), QSize(), QIcon.Selected, QIcon.Off) if self.is_on: self.label_is_on.setText("Disable") self.pushButton_switch.setIcon(self.icon_on) else: self.label_is_on.setText("Enable") self.pushButton_switch.setIcon(self.icon_off) self.pushButton_switch.setIconSize(QSize(100, 40)) self.pushButton_switch.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_switch.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_switch, 5, 2, 1, 1) self.pushButton_save_changes = QPushButton("Save", self) self.pushButton_save_changes.clicked.connect(lambda: self.on_save_changes(link)) self.pushButton_save_changes.setIconSize(QSize(100, 20)) self.pushButton_save_changes.setStyleSheet(styles.btn_dark) self.pushButton_save_changes.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_save_changes, 5, 3, 1, 2)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.frame_nav = QFrame(self) self.frame_nav.setMinimumSize(QSize(220, 300)) self.frame_nav.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.frame_nav.setFrameShape(QFrame.StyledPanel) self.frame_nav.setFrameShadow(QFrame.Raised) self.gridLayout = QGridLayout(self) self.gridLayout.setContentsMargins(11, -1, 11, -1) self.gridLayout.addWidget(self.frame_nav, 3, 0, 1, 4) # set program img and name self.label_img = QLabel(self) self.label_img.setFixedSize(QSize(60, 60)) self.label_img.setPixmap(QPixmap(os.path.join(path, 'img/icon.png'))) # self.label_img.setPixmap(QPixmap("../img/icon.png")) self.label_img.setScaledContents(True) self.gridLayout.addWidget(self.label_img, 2, 1, 1, 1) self.label_name = QLabel("WebCheck ", self) self.label_name.setStyleSheet(styles.label_icon_name) self.gridLayout.addWidget(self.label_name, 2, 2, 1, 1) self.spacer_name_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_t = QSpacerItem(20, 70, QSizePolicy.Minimum, QSizePolicy.Maximum) self.gridLayout.addItem(self.spacer_name_l, 2, 0, 1, 1) self.gridLayout.addItem(self.spacer_name_r, 2, 3, 1, 1) self.gridLayout.addItem(self.spacer_name_t, 1, 1, 1, 2) # set bottom layout for keeping gb in it self.gridLayout_b = QGridLayout(self.frame_nav) self.spacer_gb_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_t = QSpacerItem(0, 20, QSizePolicy.Minimum, QSizePolicy.Maximum) self.spacer_gb_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout_b.addItem(self.spacer_gb_l, 1, 2, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_r, 1, 0, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_t, 0, 1, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_b, 2, 1, 1, 1) # set gb and radio buttons self.groupBox = QGroupBox("", self.frame_nav) self.gridLayout_b.addWidget(self.groupBox, 1, 1, 1, 1) self.groupBox.setMinimumSize(QSize(220, 350)) self.groupBox.setStyleSheet("""QGroupBox{background-image: url(ui/img/radioline.png); border: none;}""") self.verticalLayout_gb = QVBoxLayout(self.groupBox) self.radioButton_add = QRadioButton(" Add", self.groupBox) self.radioButton_add.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_add) self.radioButton_monitored = QRadioButton(" Monitored", self.groupBox) self.radioButton_monitored.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_monitored) self.radioButton_options = QRadioButton(" Options", self.groupBox) self.radioButton_options.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_options) self.radioButton_about = QRadioButton(" About", self.groupBox) self.radioButton_about.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_about)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.setStyleSheet("""QFrame{background-color:#83a836;}""")
def __init__(self, parent=None): '''Constructor Function''' #QWidget.__init__(self,parent) QFrame.__init__(self) self.setUp_Login_UI()