def __init__(self, content: str, title='测试项信息'): super().__init__(parent=None) self.setWindowFlags(Qt.Window) self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle(title) __class__.prev_actived = True __class__.prev_window = self self.table = QTableView() self.table.horizontalHeader().setHighlightSections(True) self.table.horizontalHeader().setSectionResizeMode( QHeaderView.Interactive) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setVisible(True) self.restoreQsetting() self.table.setModel(PandasModel(content)) if QSysInfo.productType() == 'windows' and QSysInfo.productVersion( ) == '10': self.table.horizontalHeader().setStyleSheet( "QHeaderView::section { border: 1px solid #D8D8D8; }") layout = QVBoxLayout() layout.addWidget(self.table) self.setLayout(layout)
def setupUi(self, frame): super().setupUi(frame) self.frame = frame # Configure table self.tableView.horizontalHeader().setSectionsClickable(False) self.tableView.setSelectionMode(QAbstractItemView.SingleSelection) self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableView.horizontalHeader().setDefaultAlignment(Qt.AlignLeft) if QSysInfo.productType() == 'windows' and QSysInfo.productVersion() == '10': self.tableView.horizontalHeader().setStyleSheet( 'border-top: 0px; ' 'border-left: 0px; ' 'border-right: 0px; ' 'border-bottom: 1px solid gray;') # Define models self.data_file_container = table_model.DataFileContainer() self.dec_model = declination_model.Declination() self.tilt_model = TiltCurveModel( application_directory() / 'Calibration Tables') # Connect models self.tableView.setModel(self.data_file_container) self.tableView.resizeColumnsToContents() self.comboBox_tilt_tables.setModel(self.tilt_model) self.file_loader = file_loader.FileLoader(self.file_queue) self._connect_signals_to_slots() restore_last_session(self)
def setupUi(self, frame): self.frame = frame super().setupUi(frame) self.tableWidget.horizontalHeader().setSectionsClickable(False) self.tableWidget.horizontalHeader().setFixedHeight(30) self.tableWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.tableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) table_width = self.tableWidget.horizontalHeader().length() self.tableWidget.setFixedSize( table_width, self.tableWidget.verticalHeader().length() + self.tableWidget.horizontalHeader().height()) self.tableWidget.horizontalHeaderItem(0).setTextAlignment(Qt.AlignLeft) self.tableWidget.setColumnWidth(0, table_width / 2) self.tableWidget.setColumnWidth(1, table_width / 4) self.tableWidget.setColumnWidth(2, table_width / 4) if QSysInfo.productType() == 'windows' and QSysInfo.productVersion( ) == '10': self.tableWidget.horizontalHeader().setStyleSheet( 'border-top: 0px; ' 'border-left: 0px; ' 'border-right: 0px; ' 'border-bottom: 1px solid gray;') self.commands = Commands(self) self.logger = LoggerQueryThread(self.commands, self.queue) self.logger.query_update.connect(self.query_slot) self.logger.connected.connect(self.connected_slot) self.logger.error_code.connect(self.show_run_error) self.logger.error_message.connect(self.show_warning) self.logger.start() self.time_updater = TimeUpdater() self.time_updater.time_signal.connect(self.update_time_slot) self.time_updater.start() self.pushButton_sync_clock.clicked.connect( lambda: self.queue.put('sync_time')) self.pushButton_start.clicked.connect(self.run) self.pushButton_stop.clicked.connect(self.stop) self.pushButton_connected.clicked.connect(self.reset) self.status_bar = self.get_status_bar() self.status_bar.addPermanentWidget(self.statusbar_connect_status) self.statusbar_connect_status.setText(' Auto Connect ') self.status_bar.addPermanentWidget(self.statusbar_serial_number) self.status_bar.addPermanentWidget(self.statusbar_logging_status)
def __init__(self, parent=None, title='记录查询'): super().__init__(parent=parent) __class__.prev_actived = True __class__.prev_window = self self.setWindowTitle(title) self.setWindowFlags(Qt.Window) self.setAttribute(Qt.WA_DeleteOnClose) self.search_button = QPushButton('查询') self.search_button.clicked.connect(self.onSearch) header_lables = [ 'PK', 'ID', '产品', '版本', '芯片ID', '开始时间', '结束时间', '总时间', '结果', '信息' ] self.table = QTableWidget(1, len(header_lables)) self.table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.table.setHorizontalHeaderLabels(header_lables) self.table.horizontalHeader().setHighlightSections(True) self.table.horizontalHeader().setSectionResizeMode( QHeaderView.Interactive) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setVisible(False) self.table.cellDoubleClicked.connect(self.onCellClicked) self.table.hideColumn(0) self.idx = 0 if QSysInfo.productType() == 'windows' and QSysInfo.productVersion( ) == '10': self.table.horizontalHeader().setStyleSheet( "QHeaderView::section { border: 1px solid #D8D8D8; }") layout = QVBoxLayout() layout.addWidget(self.search_button) layout.addWidget(self.table) self.setLayout(layout) self.restoreQsetting()
def __init__(self, parent=None): super().__init__() self.setWindowTitle(self.tr("Welcome Lime GNU/Linux")) self.setFixedSize(700, 475) self.setWindowIcon(QIcon(":/images/limelinux-welcome.svg")) self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.setStyleSheet( "QPushButton {border: none; text-align:left; color: black;} QLabel {color:black;}" ) x = (QDesktopWidget().width() - self.width()) // 2 y = (QDesktopWidget().height() - self.height()) // 2 self.move(x, y) ####################### self.headerWidget = QWidget() self.headerWidget.setFixedHeight(80) self.headerWidget.setLayout(QHBoxLayout()) self.headerWidget.setStyleSheet( "background-image: url(:/images/background.png);") self.layout().addWidget(self.headerWidget) self.logoLabel = QLabel() self.logoLabel.setFixedSize(64, 64) self.logoLabel.setScaledContents(True) self.logoLabel.setPixmap( QIcon(":/images/lime-white.svg").pixmap(self.logoLabel.size())) self.headerWidget.layout().addWidget(self.logoLabel) self.pisiLogoLabel = QLabel() self.pisiLogoLabel.setFixedSize(157, 48) self.pisiLogoLabel.setScaledContents(True) self.pisiLogoLabel.setPixmap(QPixmap(":/images/lime.png")) self.headerWidget.layout().addWidget(self.pisiLogoLabel) self.headerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.versionLabel = QLabel() font = self.versionLabel.font() font.setPointSize(12) self.versionLabel.setFont(font) #self.versionLabel.setText("12313 - 31231") self.versionLabel.setText("{} - {}".format( QSysInfo.productVersion(), QSysInfo.currentCpuArchitecture())) self.versionLabel.setStyleSheet("color: #80ff80; font-weight: bold;") self.headerWidget.layout().addWidget(self.versionLabel) ####################### self.contentWidget = QWidget() self.contentWidget.setLayout(QVBoxLayout()) self.contentWidget.setStyleSheet("background-color: white; ") self.layout().addWidget(self.contentWidget) self.descriptionLabel = QLabel() self.descriptionLabel.setText(self.tr("Welcome to Lime Linux! Thank you for joining our community!\n\n"\ "As Lime Linux developers, we hope you enjoy using Lime Linux. "\ "The following links will guide you while using Lime Linux. Please do not "\ "hesitate to inform about your experiences, suggestions and errors you have encountered.")) self.descriptionLabel.setWordWrap(True) font = self.descriptionLabel.font() font.setFamily("DejaVu Sans") font.setPointSize(10) self.descriptionLabel.setFont(font) self.descriptionLabel.setStyleSheet("color: black;") self.contentWidget.layout().addWidget(self.descriptionLabel) self.mainLayout = QHBoxLayout() self.contentWidget.layout().addLayout(self.mainLayout) vlayoutI = QVBoxLayout() self.docLabel = QLabel() font = self.docLabel.font() font.setPointSize(14) font.setBold(True) self.docLabel.setFont(font) self.docLabel.setAlignment(Qt.AlignHCenter) self.docLabel.setText(self.tr("Documents")) vlayoutI.addWidget(self.docLabel) self.installDocButton = QPushButton() self.installDocButton.setFixedWidth(185) self.installDocButton.setCursor(Qt.PointingHandCursor) self.installDocButton.setText(self.tr("Installation Guide")) self.installDocButton.setIcon(QIcon(":/images/guide.svg")) self.installDocButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.installDocButton) self.releaseButton = QPushButton() self.releaseButton.setFixedWidth(185) self.releaseButton.setCursor(Qt.PointingHandCursor) self.releaseButton.setText(self.tr("Release Notes")) self.releaseButton.setIcon(QIcon(":/images/info.svg")) self.releaseButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.releaseButton) self.wikiButton = QPushButton() self.wikiButton.setFixedWidth(185) self.wikiButton.setCursor(Qt.PointingHandCursor) self.wikiButton.setText(self.tr("Wiki")) self.wikiButton.setIcon(QIcon(":/images/wiki.svg")) self.wikiButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.wikiButton) vlayoutII = QVBoxLayout() self.supportLabel = QLabel() font = self.supportLabel.font() font.setPointSize(14) font.setBold(True) self.supportLabel.setFont(font) self.supportLabel.setAlignment(Qt.AlignHCenter) self.supportLabel.setText(self.tr("Support")) vlayoutII.addWidget(self.supportLabel) self.forumButton = QPushButton() self.forumButton.setFixedWidth(185) self.forumButton.setCursor(Qt.PointingHandCursor) self.forumButton.setText(self.tr("Forum")) self.forumButton.setIconSize(QSize(32, 32)) self.forumButton.setIcon(QIcon(":/images/forum.svg")) vlayoutII.addWidget(self.forumButton) self.chatButton = QPushButton() self.chatButton.setFixedWidth(185) self.chatButton.setCursor(Qt.PointingHandCursor) self.chatButton.setText(self.tr("Chat Rooms")) self.chatButton.setIcon(QIcon(":/images/chat.svg")) self.chatButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.chatButton) self.bugsButton = QPushButton() self.bugsButton.setFixedWidth(185) self.bugsButton.setCursor(Qt.PointingHandCursor) self.bugsButton.setText(self.tr("Bug Report")) self.bugsButton.setIcon(QIcon(":/images/bocuk.svg")) self.bugsButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.bugsButton) vlayoutIII = QVBoxLayout() self.installLabel = QLabel() font = self.installLabel.font() font.setPointSize(14) font.setBold(True) self.installLabel.setFont(font) self.installLabel.setAlignment(Qt.AlignHCenter) self.installLabel.setText(self.tr("Installation")) vlayoutIII.addWidget(self.installLabel) self.useLiliiButton = QPushButton() self.useLiliiButton.setFixedWidth(185) self.useLiliiButton.setCursor(Qt.PointingHandCursor) self.useLiliiButton.setText(self.tr("Start Installation")) self.useLiliiButton.setIcon(QIcon.fromTheme("lilii-logo")) self.useLiliiButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.useLiliiButton) self.getInvolvedButton = QPushButton() self.getInvolvedButton.setFixedWidth(185) self.getInvolvedButton.setCursor(Qt.PointingHandCursor) self.getInvolvedButton.setText(self.tr("Join Us")) self.getInvolvedButton.setIcon(QIcon(":/images/joinus.svg")) self.getInvolvedButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.getInvolvedButton) self.donateButton = QPushButton() self.donateButton.setFixedWidth(185) self.donateButton.setCursor(Qt.PointingHandCursor) self.donateButton.setText(self.tr("Donate")) self.donateButton.setIcon(QIcon(":/images/donate.svg")) self.donateButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.donateButton) self.mainLayout.addLayout(vlayoutI) self.mainLayout.addLayout(vlayoutII) self.mainLayout.addLayout(vlayoutIII) self.noteLabel = QLabel() font = self.noteLabel.font() font.setPointSize(12) font.setBold(True) self.noteLabel.setFont(font) self.noteLabel.setText(self.tr("Note: The password is \"live\".")) self.noteLabel.setAlignment(Qt.AlignHCenter) self.contentWidget.layout().addWidget(self.noteLabel) ####################### self.footerWidget = QWidget() self.footerWidget.setFixedHeight(50) self.footerWidget.setLayout(QHBoxLayout()) self.footerWidget.setStyleSheet( "background-image: url(:/images/background.png);") self.layout().addWidget(self.footerWidget) self.facebookButton = QPushButton() self.facebookButton.setFixedSize(36, 36) self.facebookButton.setIconSize(QSize(36, 36)) self.facebookButton.setIcon(QIcon(":/images/facebook.png")) self.facebookButton.setCursor(Qt.PointingHandCursor) self.facebookButton.setToolTip(self.tr("Facebook Page")) self.footerWidget.layout().addWidget(self.facebookButton) self.twitterButton = QPushButton() self.twitterButton.setFixedSize(36, 36) self.twitterButton.setIconSize(QSize(36, 36)) self.twitterButton.setIcon(QIcon(":/images/twitter.png")) self.twitterButton.setCursor(Qt.PointingHandCursor) self.twitterButton.setToolTip(self.tr("Twitter Page")) self.footerWidget.layout().addWidget(self.twitterButton) self.youtubeButton = QPushButton() self.youtubeButton.setFixedSize(36, 36) self.youtubeButton.setIconSize(QSize(36, 36)) self.youtubeButton.setIcon(QIcon(":/images/youtube.png")) self.youtubeButton.setCursor(Qt.PointingHandCursor) self.youtubeButton.setToolTip(self.tr("Youtube Channel")) self.footerWidget.layout().addWidget(self.youtubeButton) self.githubButton = QPushButton() self.githubButton.setFixedSize(36, 36) self.githubButton.setIconSize(QSize(36, 36)) self.githubButton.setIcon(QIcon(":/images/git.svg")) self.githubButton.setCursor(Qt.PointingHandCursor) self.githubButton.setToolTip(self.tr("GitHub Page")) self.footerWidget.layout().addWidget(self.githubButton) self.footerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.openCheckBox = QCheckBox() self.openCheckBox.setChecked( os.path.exists( os.path.join(os.environ["HOME"], ".config", "autostart", "limelinux-welcome.desktop"))) font = self.openCheckBox.font() font.setBold(True) self.openCheckBox.setFont(font) self.openCheckBox.setText(self.tr("Show on startup")) self.openCheckBox.setStyleSheet("color: #80ff80;") self.footerWidget.layout().addWidget(self.openCheckBox) self.facebookButton.clicked.connect(self.facebookPage) self.youtubeButton.clicked.connect(self.youtubePage) self.twitterButton.clicked.connect(self.twitterPage) self.githubButton.clicked.connect(self.githubPage) self.installDocButton.clicked.connect(self.installedDoc) self.releaseButton.clicked.connect(self.releaseNote) self.wikiButton.clicked.connect(self.wikiPage) self.forumButton.clicked.connect(self.forumPage) self.chatButton.clicked.connect(self.chatPages) self.getInvolvedButton.clicked.connect(self.involvedPage) self.donateButton.clicked.connect(self.donatePage) self.openCheckBox.clicked.connect(self.openState) self.bugsButton.clicked.connect(self.issuePage)
def __init__(self, parent=None): super().__init__() self.setWindowTitle(self.tr("Welcome Pisi GNU/Linux")) self.setFixedSize(700, 475) self.setWindowIcon(QIcon(":/images/pisilinux-welcome.svg")) self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.setStyleSheet("QPushButton {border: none; text-align: left; color:black;} QLabel {color:black;}") x = (QDesktopWidget().width() - self.width()) // 2 y = (QDesktopWidget().height() - self.height()) // 2 self.move(x, y) # The header code: self.headerWidget = QWidget() self.headerWidget.setFixedHeight(80) self.headerWidget.setLayout(QHBoxLayout()) self.headerWidget.setStyleSheet("background-image:url(:/images/background.png);") self.layout().addWidget(self.headerWidget) self.pisiWhiteLogo = QLabel() self.pisiWhiteLogo.setFixedSize(64, 64) self.pisiWhiteLogo.setScaledContents(True) self.pisiWhiteLogo.setPixmap( QIcon(":/images/pisi-white.svg").pixmap(self.pisiWhiteLogo.size())) self.headerWidget.layout().addWidget(self.pisiWhiteLogo) self.pisiTextLabel = QLabel() self.pisiTextLabel.setFixedSize(157, 48) self.pisiTextLabel.setScaledContents(True) self.pisiTextLabel.setPixmap(QPixmap(":/images/pisi-text.png")) self.headerWidget.layout().addWidget(self.pisiTextLabel) self.headerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.versionLabel = QLabel() font = self.versionLabel.font() font.setPointSize(12) self.versionLabel.setFont(font) self.versionLabel.setText( "{} - {}".format( QSysInfo.productVersion(), QSysInfo.currentCpuArchitecture())) self.versionLabel.setStyleSheet("color: white; font-weight: bold;") self.headerWidget.layout().addWidget(self.versionLabel) # The middle area code: self.contentWidget = QWidget() self.contentWidget.setLayout(QVBoxLayout()) self.contentWidget.setStyleSheet("background-color: white;") self.layout().addWidget(self.contentWidget) self.meetingLabel = QLabel() self.meetingLabel.setText( self.tr("Welcome to Pisi GNU/Linux!" " Thank you for joining our community!\n\n" "As Pisi GNU/Linux developers," " we hope you enjoy using Pisi GNU/Linux." " The following links will guide you while" " using Pisi GNU/Linux. Please do not" " hesitate to inform about your experiences," " suggestions and errors you have encountered.")) self.meetingLabel.setWordWrap(True) font = self.meetingLabel.font() font.setPointSize(10) self.meetingLabel.setFont(font) self.meetingLabel.setAlignment(Qt.AlignHCenter) self.meetingLabel.setStyleSheet("color: black;") self.contentWidget.layout().addWidget(self.meetingLabel) self.mainLayout = QHBoxLayout() self.contentWidget.layout().addLayout(self.mainLayout) vlayoutI = QVBoxLayout() self.docsHeader = QLabel() font = self.docsHeader.font() font.setPointSize(14) font.setBold(True) self.docsHeader.setFont(font) self.docsHeader.setAlignment(Qt.AlignHCenter) self.docsHeader.setText(self.tr("Documents")) vlayoutI.addWidget(self.docsHeader) self.installationDocButton = QPushButton() self.installationDocButton.setFixedWidth(160) self.installationDocButton.setCursor(Qt.PointingHandCursor) self.installationDocButton.setText(self.tr("Installation Guide")) self.installationDocButton.setIcon(QIcon(':/images/guide.svg')) self.installationDocButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.installationDocButton) self.releaseNotesButton = QPushButton() self.releaseNotesButton.setFixedWidth(160) self.releaseNotesButton.setCursor(Qt.PointingHandCursor) self.releaseNotesButton.setText(self.tr("Release Notes")) self.releaseNotesButton.setIcon(QIcon(':/images/info.svg')) self.releaseNotesButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.releaseNotesButton) self.wikiButton = QPushButton() self.wikiButton.setFixedWidth(160) self.wikiButton.setCursor(Qt.PointingHandCursor) self.wikiButton.setText(self.tr("Pisi GNU/Linux Wiki")) self.wikiButton.setIcon(QIcon(':/images/wikipedia-logo.svg')) self.wikiButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.wikiButton) vlayoutII = QVBoxLayout() self.supportHeader = QLabel() font = self.supportHeader.font() font.setPointSize(14) font.setBold(True) self.supportHeader.setFont(font) self.supportHeader.setAlignment(Qt.AlignHCenter) self.supportHeader.setText(self.tr("Support")) vlayoutII.addWidget(self.supportHeader) self.forumButton = QPushButton() self.forumButton.setFixedWidth(160) self.forumButton.setCursor(Qt.PointingHandCursor) self.forumButton.setText(self.tr("Forum")) self.forumButton.setIconSize(QSize(32, 32)) self.forumButton.setIcon(QIcon(':/images/forum.svg')) vlayoutII.addWidget(self.forumButton) self.chatButton = QPushButton() self.chatButton.setFixedWidth(160) self.chatButton.setCursor(Qt.PointingHandCursor) self.chatButton.setText(self.tr("Chat Rooms")) self.chatButton.setIcon(QIcon(':/images/chat.svg')) self.chatButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.chatButton) self.bugsButton = QPushButton() self.bugsButton.setFixedWidth(160) self.bugsButton.setCursor(Qt.PointingHandCursor) self.bugsButton.setText(self.tr("Bug Report")) self.bugsButton.setIcon(QIcon(':/images/bug.svg')) self.bugsButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.bugsButton) vlayoutIII = QVBoxLayout() self.installationHeader = QLabel() font = self.installationHeader.font() font.setPointSize(14) font.setBold(True) self.installationHeader.setFont(font) self.installationHeader.setAlignment(Qt.AlignHCenter) self.installationHeader.setText(self.tr("Installation")) vlayoutIII.addWidget(self.installationHeader) # TODO: Also for YALI self.calamaresButton = QPushButton() self.calamaresButton.setFixedWidth(160) self.calamaresButton.setCursor(Qt.PointingHandCursor) self.calamaresButton.setText(self.tr("Start Installation")) self.calamaresButton.setIcon(QIcon(':/images/calamares.svg')) self.calamaresButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.calamaresButton) self.joinUsButton = QPushButton() self.joinUsButton.setFixedWidth(160) self.joinUsButton.setCursor(Qt.PointingHandCursor) self.joinUsButton.setText(self.tr("Join Us")) self.joinUsButton.setIcon(QIcon(':/images/joinus.svg')) self.joinUsButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.joinUsButton) self.donateButton = QPushButton() self.donateButton.setFixedWidth(160) self.donateButton.setCursor(Qt.PointingHandCursor) self.donateButton.setText(self.tr("Ev")) self.donateButton.setIcon(QIcon(':/images/ev.svg')) self.donateButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.donateButton) self.mainLayout.addLayout(vlayoutI) self.mainLayout.addLayout(vlayoutII) self.mainLayout.addLayout(vlayoutIII) self.noteLabel = QLabel() font = self.noteLabel.font() font.setPointSize(12) font.setBold(True) self.noteLabel.setFont(font) self.noteLabel.setText(self.tr("Note: The password is \"live\".")) self.noteLabel.setAlignment(Qt.AlignHCenter) self.noteLabel.setMinimumSize(250, 50) self.noteLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self.contentWidget.layout().addWidget(self.noteLabel) # The footer code: self.footerWidget = QWidget() self.footerWidget.setFixedHeight(50) self.footerWidget.setLayout(QHBoxLayout()) self.footerWidget.setStyleSheet( "background-image: url(:/images//background.png);") self.layout().addWidget(self.footerWidget) self.facebookButton = QPushButton() self.facebookButton.setFixedSize(36, 36) self.facebookButton.setIconSize(QSize(36, 36)) self.facebookButton.setIcon(QIcon(':/images/facebook.svg')) self.facebookButton.setCursor(Qt.PointingHandCursor) self.facebookButton.setToolTip(self.tr("Facebook Page")) self.footerWidget.layout().addWidget(self.facebookButton) self.twitterButton = QPushButton() self.twitterButton.setFixedSize(36, 36) self.twitterButton.setIconSize(QSize(36, 36)) self.twitterButton.setIcon(QIcon(':/images/twitter.svg')) self.twitterButton.setCursor(Qt.PointingHandCursor) self.twitterButton.setToolTip(self.tr("Twitter Page")) self.footerWidget.layout().addWidget(self.twitterButton) self.googleButton = QPushButton() self.googleButton.setFixedSize(36, 36) self.googleButton.setIconSize(QSize(36, 36)) self.googleButton.setIcon(QIcon(':/images/google-plus.svg')) self.googleButton.setCursor(Qt.PointingHandCursor) self.googleButton.setToolTip(self.tr("Google+ Page")) self.footerWidget.layout().addWidget(self.googleButton) self.instagramButton = QPushButton() self.instagramButton.setFixedSize(36, 36) self.instagramButton.setIconSize(QSize(36, 36)) self.instagramButton.setIcon(QIcon(':/images/instagram.svg')) self.instagramButton.setCursor(Qt.PointingHandCursor) self.instagramButton.setToolTip(self.tr("Instagram Page")) self.footerWidget.layout().addWidget(self.instagramButton) self.githubButton = QPushButton() self.githubButton.setFixedSize(36, 36) self.githubButton.setIconSize(QSize(36, 36)) self.githubButton.setIcon(QIcon(':/images/github-logo.svg')) self.githubButton.setCursor(Qt.PointingHandCursor) self.githubButton.setToolTip(self.tr("GitHub Page")) self.footerWidget.layout().addWidget(self.githubButton) self.footerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.startupCheckBox = QCheckBox() self.startupCheckBox.setChecked( os.path.exists(os.path.join(os.environ["HOME"], ".config", "autostart", "pisilinux-welcome.desktop"))) font = self.startupCheckBox.font() font.setBold(True) self.startupCheckBox.setFont(font) self.startupCheckBox.setText(self.tr("Show on startup")) self.startupCheckBox.setStyleSheet("color: white;") self.footerWidget.layout().addWidget(self.startupCheckBox) self.facebookButton.clicked.connect(self.facebookPage) self.twitterButton.clicked.connect(self.twitterPage) self.googleButton.clicked.connect(self.googlePage) self.instagramButton.clicked.connect(self.instagramPage) self.githubButton.clicked.connect(self.githubPage) self.releaseNotesButton.clicked.connect(self.releaseNotes) self.wikiButton.clicked.connect(self.wikiPage) self.forumButton.clicked.connect(self.forumPage) self.chatButton.clicked.connect(self.chatPages) self.joinUsButton.clicked.connect(self.joinUsPage) self.donateButton.clicked.connect(self.homePage) self.startupCheckBox.clicked.connect(self.startupState) self.bugsButton.clicked.connect(self.issuesPage)
def __init__(self, parent=None): super().__init__() self.setWindowTitle(self.tr("Welcome Pisi GNU/Linux")) self.setFixedSize(700, 475) self.setWindowIcon(QIcon(":/images/pisilinux-welcome.svg")) self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.setStyleSheet( "QPushButton {border: none; text-align: left; color:black;} QLabel {color:black;}" ) x = (QDesktopWidget().width() - self.width()) // 2 y = (QDesktopWidget().height() - self.height()) // 2 self.move(x, y) # The header code: self.headerWidget = QWidget() self.headerWidget.setFixedHeight(80) self.headerWidget.setLayout(QHBoxLayout()) self.headerWidget.setStyleSheet( "background-image:url(:/images/background.png);") self.layout().addWidget(self.headerWidget) self.pisiWhiteLogo = QLabel() self.pisiWhiteLogo.setFixedSize(64, 64) self.pisiWhiteLogo.setScaledContents(True) self.pisiWhiteLogo.setPixmap( QIcon(":/images/pisi-white.svg").pixmap(self.pisiWhiteLogo.size())) self.headerWidget.layout().addWidget(self.pisiWhiteLogo) self.pisiTextLabel = QLabel() self.pisiTextLabel.setFixedSize(157, 48) self.pisiTextLabel.setScaledContents(True) self.pisiTextLabel.setPixmap(QPixmap(":/images/pisi-text.png")) self.headerWidget.layout().addWidget(self.pisiTextLabel) self.headerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.versionLabel = QLabel() font = self.versionLabel.font() font.setPointSize(12) self.versionLabel.setFont(font) self.versionLabel.setText("{} - {}".format( QSysInfo.productVersion(), QSysInfo.currentCpuArchitecture())) self.versionLabel.setStyleSheet("color: white; font-weight: bold;") self.headerWidget.layout().addWidget(self.versionLabel) # The middle area code: self.contentWidget = QWidget() self.contentWidget.setLayout(QVBoxLayout()) self.contentWidget.setStyleSheet("background-color: white;") self.layout().addWidget(self.contentWidget) self.meetingLabel = QLabel() self.meetingLabel.setText( self.tr("Welcome to Pisi GNU/Linux!" " Thank you for joining our community!\n\n" "As Pisi GNU/Linux developers," " we hope you enjoy using Pisi GNU/Linux." " The following links will guide you while" " using Pisi GNU/Linux. Please do not" " hesitate to inform about your experiences," " suggestions and errors you have encountered.")) self.meetingLabel.setWordWrap(True) font = self.meetingLabel.font() font.setPointSize(10) self.meetingLabel.setFont(font) self.meetingLabel.setAlignment(Qt.AlignHCenter) self.meetingLabel.setStyleSheet("color: black;") self.contentWidget.layout().addWidget(self.meetingLabel) self.mainLayout = QHBoxLayout() self.contentWidget.layout().addLayout(self.mainLayout) vlayoutI = QVBoxLayout() self.docsHeader = QLabel() font = self.docsHeader.font() font.setPointSize(14) font.setBold(True) self.docsHeader.setFont(font) self.docsHeader.setAlignment(Qt.AlignHCenter) self.docsHeader.setText(self.tr("Documents")) vlayoutI.addWidget(self.docsHeader) self.installationDocButton = QPushButton() self.installationDocButton.setFixedWidth(160) self.installationDocButton.setCursor(Qt.PointingHandCursor) self.installationDocButton.setText(self.tr("Installation Guide")) self.installationDocButton.setIcon(QIcon(':/images/guide.svg')) self.installationDocButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.installationDocButton) self.releaseNotesButton = QPushButton() self.releaseNotesButton.setFixedWidth(160) self.releaseNotesButton.setCursor(Qt.PointingHandCursor) self.releaseNotesButton.setText(self.tr("Release Notes")) self.releaseNotesButton.setIcon(QIcon(':/images/info.svg')) self.releaseNotesButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.releaseNotesButton) self.wikiButton = QPushButton() self.wikiButton.setFixedWidth(160) self.wikiButton.setCursor(Qt.PointingHandCursor) self.wikiButton.setText(self.tr("Pisi GNU/Linux Wiki")) self.wikiButton.setIcon(QIcon(':/images/wikipedia-logo.svg')) self.wikiButton.setIconSize(QSize(32, 32)) vlayoutI.addWidget(self.wikiButton) vlayoutII = QVBoxLayout() self.supportHeader = QLabel() font = self.supportHeader.font() font.setPointSize(14) font.setBold(True) self.supportHeader.setFont(font) self.supportHeader.setAlignment(Qt.AlignHCenter) self.supportHeader.setText(self.tr("Support")) vlayoutII.addWidget(self.supportHeader) self.forumButton = QPushButton() self.forumButton.setFixedWidth(160) self.forumButton.setCursor(Qt.PointingHandCursor) self.forumButton.setText(self.tr("Forum")) self.forumButton.setIconSize(QSize(32, 32)) self.forumButton.setIcon(QIcon(':/images/forum.svg')) vlayoutII.addWidget(self.forumButton) self.chatButton = QPushButton() self.chatButton.setFixedWidth(160) self.chatButton.setCursor(Qt.PointingHandCursor) self.chatButton.setText(self.tr("Chat Rooms")) self.chatButton.setIcon(QIcon(':/images/chat.svg')) self.chatButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.chatButton) self.bugsButton = QPushButton() self.bugsButton.setFixedWidth(160) self.bugsButton.setCursor(Qt.PointingHandCursor) self.bugsButton.setText(self.tr("Bug Report")) self.bugsButton.setIcon(QIcon(':/images/bug.svg')) self.bugsButton.setIconSize(QSize(32, 32)) vlayoutII.addWidget(self.bugsButton) vlayoutIII = QVBoxLayout() self.installationHeader = QLabel() font = self.installationHeader.font() font.setPointSize(14) font.setBold(True) self.installationHeader.setFont(font) self.installationHeader.setAlignment(Qt.AlignHCenter) self.installationHeader.setText(self.tr("Installation")) vlayoutIII.addWidget(self.installationHeader) # TODO: Also for YALI self.calamaresButton = QPushButton() self.calamaresButton.setFixedWidth(160) self.calamaresButton.setCursor(Qt.PointingHandCursor) self.calamaresButton.setText(self.tr("Start Installation")) self.calamaresButton.setIcon(QIcon(':/images/calamares.svg')) self.calamaresButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.calamaresButton) self.joinUsButton = QPushButton() self.joinUsButton.setFixedWidth(160) self.joinUsButton.setCursor(Qt.PointingHandCursor) self.joinUsButton.setText(self.tr("Join Us")) self.joinUsButton.setIcon(QIcon(':/images/joinus.svg')) self.joinUsButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.joinUsButton) self.donateButton = QPushButton() self.donateButton.setFixedWidth(160) self.donateButton.setCursor(Qt.PointingHandCursor) self.donateButton.setText(self.tr("Ev")) self.donateButton.setIcon(QIcon(':/images/ev.svg')) self.donateButton.setIconSize(QSize(32, 32)) vlayoutIII.addWidget(self.donateButton) self.mainLayout.addLayout(vlayoutI) self.mainLayout.addLayout(vlayoutII) self.mainLayout.addLayout(vlayoutIII) self.noteLabel = QLabel() font = self.noteLabel.font() font.setPointSize(12) font.setBold(True) self.noteLabel.setFont(font) self.noteLabel.setText(self.tr("Note: The password is \"live\".")) self.noteLabel.setAlignment(Qt.AlignHCenter) self.noteLabel.setMinimumSize(250, 50) self.noteLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self.contentWidget.layout().addWidget(self.noteLabel) # The footer code: self.footerWidget = QWidget() self.footerWidget.setFixedHeight(50) self.footerWidget.setLayout(QHBoxLayout()) self.footerWidget.setStyleSheet( "background-image: url(:/images//background.png);") self.layout().addWidget(self.footerWidget) self.facebookButton = QPushButton() self.facebookButton.setFixedSize(36, 36) self.facebookButton.setIconSize(QSize(36, 36)) self.facebookButton.setIcon(QIcon(':/images/facebook.svg')) self.facebookButton.setCursor(Qt.PointingHandCursor) self.facebookButton.setToolTip(self.tr("Facebook Page")) self.footerWidget.layout().addWidget(self.facebookButton) self.twitterButton = QPushButton() self.twitterButton.setFixedSize(36, 36) self.twitterButton.setIconSize(QSize(36, 36)) self.twitterButton.setIcon(QIcon(':/images/twitter.svg')) self.twitterButton.setCursor(Qt.PointingHandCursor) self.twitterButton.setToolTip(self.tr("Twitter Page")) self.footerWidget.layout().addWidget(self.twitterButton) self.googleButton = QPushButton() self.googleButton.setFixedSize(36, 36) self.googleButton.setIconSize(QSize(36, 36)) self.googleButton.setIcon(QIcon(':/images/google-plus.svg')) self.googleButton.setCursor(Qt.PointingHandCursor) self.googleButton.setToolTip(self.tr("Google+ Page")) self.footerWidget.layout().addWidget(self.googleButton) self.instagramButton = QPushButton() self.instagramButton.setFixedSize(36, 36) self.instagramButton.setIconSize(QSize(36, 36)) self.instagramButton.setIcon(QIcon(':/images/instagram.svg')) self.instagramButton.setCursor(Qt.PointingHandCursor) self.instagramButton.setToolTip(self.tr("Instagram Page")) self.footerWidget.layout().addWidget(self.instagramButton) self.githubButton = QPushButton() self.githubButton.setFixedSize(36, 36) self.githubButton.setIconSize(QSize(36, 36)) self.githubButton.setIcon(QIcon(':/images/github-logo.svg')) self.githubButton.setCursor(Qt.PointingHandCursor) self.githubButton.setToolTip(self.tr("GitHub Page")) self.footerWidget.layout().addWidget(self.githubButton) self.footerWidget.layout().addItem( QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.startupCheckBox = QCheckBox() self.startupCheckBox.setChecked( os.path.exists( os.path.join(os.environ["HOME"], ".config", "autostart", "pisilinux-welcome.desktop"))) font = self.startupCheckBox.font() font.setBold(True) self.startupCheckBox.setFont(font) self.startupCheckBox.setText(self.tr("Show on startup")) self.startupCheckBox.setStyleSheet("color: white;") self.footerWidget.layout().addWidget(self.startupCheckBox) self.facebookButton.clicked.connect(self.facebookPage) self.twitterButton.clicked.connect(self.twitterPage) self.googleButton.clicked.connect(self.googlePage) self.instagramButton.clicked.connect(self.instagramPage) self.githubButton.clicked.connect(self.githubPage) self.releaseNotesButton.clicked.connect(self.releaseNotes) self.wikiButton.clicked.connect(self.wikiPage) self.forumButton.clicked.connect(self.forumPage) self.chatButton.clicked.connect(self.chatPages) self.joinUsButton.clicked.connect(self.joinUsPage) self.donateButton.clicked.connect(self.homePage) self.startupCheckBox.clicked.connect(self.startupState) self.bugsButton.clicked.connect(self.issuesPage)
def isValidWinVer() -> bool: ver = QSysInfo.productVersion() return True if ver not in {'XP', 'Vista'} else False