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 get_os_name(self): global q_os_version_available try: os_name = QSysInfo.prettyProductName() if q_os_version_available: ver = QOperatingSystemVersion.current() if ver.name() != '': os_name += ' {} '.format(ver.name()) if ver.segmentCount() > 2: os_name += '{}.{}.{}'.format(ver.majorVersion(), ver.minorVersion(), ver.microVersion()) elif ver.segmentCount == 2: os_name += '{}.{}'.format(ver.majorVersion(), ver.minorVersion()) elif ver.segmentCount == 1: os_name += '{}'.format(ver.majorVersion()) kernel_name = QSysInfo.kernelType() + ' ' + QSysInfo.kernelVersion( ) if os_name != kernel_name: os_name += ' ({})'.format(kernel_name) return os_name except Exception as e: return platform.platform()
def stylize(obj): import sys def setDefaultStyleSheet(obj): obj.setStyleSheet('QWidget#%s{' ' border:1px solid rgb(100, 100, 64);' ' border-radius:6px;' ' background-color:rgb(32,32,32);' '}' % obj.objectName()) if sys.platform == 'darwin': if QSysInfo.macVersion() == QSysInfo.MV_10_9: pass else: setDefaultStyleSheet(obj) elif sys.platform == 'win32': if QSysInfo.windowsVersion() == QSysInfo.WV_WINDOWS7: # obj.setWindowFlags(Qt.CustomizeWindowHint) ''' from PyQt5.Qt import QtWin, Qt if QtWin.isCompositionEnabled(): QtWin.extendFrameIntoClientArea(obj, -1, -1, -1, -1) obj.setAttribute(Qt.WA_TranslucentBackground, True) obj.setAttribute(Qt.WA_NoSystemBackground, True) obj.setStyleSheet('%s{background:transparent;}' % obj.objectName()) else: obj.setAttribute(Qt.WA_TranslucentBackground, True) obj.setAttribute(Qt.WA_NoSystemBackground, True) setDefaultStyleSheet(obj) ''' setDefaultStyleSheet(obj) else: setDefaultStyleSheet(obj) else: setDefaultStyleSheet(obj)
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)
async def _do_check_new_version(url): current_version = Version(__version__) def _fetch_latest_release(): with urlopen(Request(url, method="GET")) as req: latest_v = req.read() return Version(latest_v.decode("ascii")) latest_version = await trio.to_thread.run_sync(_fetch_latest_release) if latest_version: if latest_version > current_version: if platform.system() == "Windows": current_arch = QSysInfo().currentCpuArchitecture() if current_arch == "x86_64": win_version = "win64" return ( latest_version, f"https://dl.guardata.app/guardata-{latest_version.public}-{win_version}-setup.exe", ) elif platform.system() == "Darwin": return ( latest_version, f"https://dl.guardata.app/guardata_{latest_version.public}.dmg", ) return None
def _onOpenKeyboard(self): kernelType = QSysInfo.kernelType() if kernelType == 'winnt': try: path = glob.glob( r'C:\Windows\WinSxS\amd64_microsoft-windows-osk_*\osk.exe' )[0] ret = QProcess.startDetached(path) self.resultEdit.append('start 64 osk: %s' % ret) except Exception as e: self.resultEdit.append('start osk error: %s' % e) try: # 32位程序调用64位操作系统下的程序会被重定向到SysWOW64目录 # 可通过`Wow64DisableWow64FsRedirection`和`Wow64RevertWow64FsRedirection`控制 ret = QProcess.startDetached(r'C:\Windows\system32\osk.exe') self.resultEdit.append('start 32 osk: %s' % ret) except Exception as e: self.resultEdit.append('start osk error: %s' % e) elif kernelType == 'darwin': pass # elif kernelType=='linux': else: ret = QProcess.startDetached('florence') self.resultEdit.append('start florence: %s' % ret) ret = QProcess.startDetached('onboard') self.resultEdit.append('start onboard: %s' % ret) ret = QProcess.startDetached('kvkbd') self.resultEdit.append('start kvkbd: %s' % ret)
async def _do_check_new_version(url, api_url, check_pre=False): current_version = _extract_version(__version__) def _fetch_json_releases(): # urlopen automatically follows redirections with urlopen(Request(url, method="GET")) as req: resolved_url = req.geturl() latest_from_head = _extract_version(resolved_url) if ( latest_from_head and current_version and current_version < latest_from_head or check_pre # As latest doesn't include GitHub prerelease ): with urlopen(Request(api_url, method="GET")) as req_api: try: return latest_from_head, json.loads(req_api.read()) except JSONDecodeError: return latest_from_head, None else: return latest_from_head, None latest_from_head, json_releases = await trio.to_thread.run_sync(_fetch_json_releases) if json_releases: current_arch = QSysInfo().currentCpuArchitecture() if current_arch == "x86_64": win_version = "win64" elif current_arch == "i386": win_version = "win32" else: return latest_from_head, url latest_version = Version("0.0.0") latest_url = "" try: for release in json_releases: if release["draft"]: continue if release["prerelease"] and not check_pre: continue for asset in release["assets"]: if asset["name"].endswith(f"-{win_version}-setup.exe"): asset_version = _extract_version(release["tag_name"]) if ( asset_version and asset_version > latest_version and (not asset_version.is_prerelease or check_pre) ): latest_version = asset_version latest_url = asset["browser_download_url"] # In case something went wrong, still better to redirect to GitHub except (KeyError, TypeError): return latest_from_head, url if latest_version > current_version: return latest_version, latest_url elif latest_from_head > current_version: # There is a new release flagged as stable on GitHub, but we failed to load the json return latest_from_head, url return None
def on_run_on_startup_toggled(self, i_checked_bool): if QSysInfo.kernelType() == "linux": pass elif QSysInfo.kernelType() == "darwin": plist = "com.matc.mindfulness-at-the-computer.plist" source_file = mc.mc_global.get_user_files_path(plist) target_dir = os.path.join(os.path.expanduser("~"), "Library/LaunchAgents/") if i_checked_bool and os.path.isdir("/Applications/mindfulness-at-the-computer.app"): copyfile(source_file, os.path.join(target_dir, plist)) elif os.path.isfile(os.path.join(target_dir, plist)): os.remove(os.path.join(target_dir, plist)) elif QSysInfo.kernelType() == "winnt": pass mc.model.SettingsM.get().run_on_startup = i_checked_bool
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 on_run_on_startup_toggled(self, i_checked_bool): if QSysInfo.kernelType() == "linux": pass elif QSysInfo.kernelType() == "darwin": plist = "com.matc.mindfulness-at-the-computer.plist" source_file = mc.mc_global.get_user_files_path(plist) target_dir = os.path.join(os.path.expanduser("~"), "Library/LaunchAgents/") if i_checked_bool and os.path.isdir( "/Applications/mindfulness-at-the-computer.app"): copyfile(source_file, os.path.join(target_dir, plist)) elif os.path.isfile(os.path.join(target_dir, plist)): os.remove(os.path.join(target_dir, plist)) elif QSysInfo.kernelType() == "winnt": pass mc.model.SettingsM.get().run_on_startup = i_checked_bool
def setMessage(self, exType, exValue, exTrace): """Generate a message and append session data, error info and error traceback. """ from traceback import format_tb from novelwriter import __issuesurl__, __version__ from PyQt5.Qt import PYQT_VERSION_STR from PyQt5.QtCore import QT_VERSION_STR, QSysInfo self.msgHead.setText(( "<p>An unhandled error has been encountered.</p>" "<p>Please report this error by submitting an issue report on " "GitHub, providing a description and including the error " "message and traceback shown below.</p>" "<p>URL: <a href='{issueUrl}'>{issueUrl}</a></p>" ).format( issueUrl=__issuesurl__, )) try: kernelVersion = QSysInfo.kernelVersion() except Exception: kernelVersion = "Unknown" try: import lxml lxmlVersion = lxml.__version__ except Exception: lxmlVersion = "Unknown" try: import enchant enchantVersion = enchant.__version__ except Exception: enchantVersion = "Unknown" try: exTrace = "\n".join(format_tb(exTrace)) self.msgBody.setPlainText(( "Environment:\n" f"novelWriter Version: {__version__}\n" f"Host OS: {sys.platform} ({kernelVersion})\n" f"Python: {sys.version.split()[0]} ({sys.hexversion:#x})\n" f"Qt: {QT_VERSION_STR}, PyQt: {PYQT_VERSION_STR}\n" f"lxml: {lxmlVersion}\n" f"enchant: {enchantVersion}\n\n" f"{exType.__name__}:\n{str(exValue)}\n\n" f"Traceback:\n{exTrace}\n" )) except Exception: self.msgBody.setPlainText("Failed to generate error report ...") return
def buildUI(self): self.process = Process(self.dataReady, self.onError, self.onOutput, self.isFinished, self) self.cmdField = PlainTextEdit({ 'lwm': QPlainTextEdit.NoWrap, 'sfh': 25, 'vsbp': SCROLLBAROFF, 'adr': True }) self.textWindow = PlainTextEdit({'rol': True}, self) self.cursor = self.cmdField.textCursor() self.copySelectedTextAction = ShortCut('Copy', 'Copy', 'Shift+Ctrl+c', self.copyText, self) self.cancelAction = ShortCut('Cancel', 'Cancel', 'Ctrl+c', self.killProcess, self) self.pasteTextAction = ShortCut('Paste', 'Paste', 'Shift+Ctrl+v', self.pasteText, self) self.textWindow.addActions( [self.cancelAction, self.copySelectedTextAction]) self.cmdField.addAction(self.pasteTextAction) self.cmdField.installEventFilter(self) self.cursorEnd() sysinfo = QSysInfo() myMachine = "CPU Architecture: {0}***{1}***{2}***{3}".format( sysinfo.currentCpuArchitecture(), sysinfo.prettyProductName(), sysinfo.kernelType(), sysinfo.kernelVersion()) self.statusBar = StatusBar(self) self.statusBar.showMessage(myMachine, 0) self.layout.addWidget(self.textWindow) self.layout.addWidget(self.cmdField) self.layout.addWidget(self.statusBar)
def setMessage(self, exType, exValue, exTrace): """Generate a message and append session data, error info and error traceback. """ import sys from traceback import format_tb from nw import __issuesurl__, __version__ from PyQt5.Qt import PYQT_VERSION_STR from PyQt5.QtCore import QT_VERSION_STR, QSysInfo self.msgHead.setText(( "<p>An unhandled error has been encountered.</p>" "<p>Please report this error by submitting an issue report on " "GitHub, providing a description and including the error " "message and traceback shown below.</p>" "<p>URL: <a href='{issueUrl}'>{issueUrl}</a></p>" ).format( issueUrl = __issuesurl__, )) try: kernelVersion = QSysInfo.kernelVersion() except Exception: kernelVersion = "Unknown" try: self.msgBody.setPlainText(( "Environment:\n" "novelWriter Version: {nwVersion}\n" "Host OS: {osType} ({osKernel})\n" "Python: {pyVersion} ({pyHexVer:#x})\n" "Qt: {qtVers}, PyQt: {pyqtVers}\n" "\n" "{exType}:\n{exMessage}\n" "\n" "Traceback:\n{exTrace}\n" ).format( nwVersion = __version__, osType = sys.platform, osKernel = kernelVersion, pyVersion = sys.version.split()[0], pyHexVer = sys.hexversion, qtVers = QT_VERSION_STR, pyqtVers = PYQT_VERSION_STR, exType = exType.__name__, exMessage = str(exValue), exTrace = "\n".join(format_tb(exTrace)), )) except Exception: self.msgBody.setPlainText("Failed to generate error report ...") return
def __init_components(self): """Inicializa los atributos de la clase y otros componentes del objeto. Note: Esta función no debe ser llamada desde el exterior, puesto que su uso es interno en la clase. """ self.setFixedWidth(440) self.setFixedHeight(330) self.layout = QVBoxLayout(self) self.socios_check_box = QCheckBox() self.prestamos_check_box = QCheckBox() self.socios_path = QLineEdit() self.prestamos_path = QLineEdit() self.start_with_so_check_box = QCheckBox("Iniciar con el sistema operativo") socios_button = QPushButton() prestamos_button = QPushButton() socios_button.setIcon(QIcon(":res/search_icon.png")) socios_button.setStyleSheet("height: 18px; background-color: #232629;") prestamos_button.setIcon(QIcon(":res/search_icon.png")) prestamos_button.setStyleSheet("height: 18px; background-color: #232629;") cancel_button = QPushButton("Cancelar") cancel_button.setObjectName("normal_button") accept_button = QPushButton("Aceptar") accept_button.setObjectName("accept_button") self.__load_options() self.layout.addLayout(HLayout( self.socios_check_box, QLabel("Archivo de Socios y Ahorros"), True)) self.layout.addLayout(HLayout(self.socios_path, socios_button)) self.layout.addSpacing(2) self.layout.addLayout(HLayout( self.prestamos_check_box, QLabel("Archivo de Préstamos"), True)) self.layout.addLayout(HLayout(self.prestamos_path, prestamos_button)) if QSysInfo.productType() == "windows": self.layout.addSpacing(10) self.layout.addWidget(self.start_with_so_check_box) self.layout.addStretch() self.layout.addLayout(HLayout(cancel_button, accept_button)) self.setModal(True) socios_button.clicked.connect(self.__select_socios_path) prestamos_button.clicked.connect(self.__select_prestamos_path) cancel_button.clicked.connect(self.reject) accept_button.clicked.connect(self.__save_state)
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 get_defaultstyle() -> str: style = STYLE_COOL if platform == "win32": version_str = QSysInfo.kernelVersion() if "." in version_str: dot_index = version_str.index(".") if dot_index != -1: version_str = version_str[: dot_index + 2] version_str.replace(".", "0") version_double, ok = QLocale().toDouble(version_str) if version_double >= 602: style = STYLE_THRESHOLD elif platform == "darwin": style = STYLE_VIENNA return style
def set_start_on_system(cls): """Habilita la opción de iniciar la aplicación con el sistema. Esta funcionalidad solo se habilita si el sistema es Windows y si se está ejecutando desde un .exe """ app_path = QCoreApplication.applicationFilePath() if QSysInfo.productType() == "windows" \ and os.path.basename(app_path) == "capounet_sync.exe": settings = QSettings( "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings.NativeFormat) if cls.start_on_system: settings.setValue("CAPOUNET SYNC", QDir.toNativeSeparators(app_path)) settings.sync() else: settings.remove("CAPOUNET SYNC")
async def _do_check_new_version(url, api_url): # urlopen automatically follows redirections resolved_url = (await _async_get(url, method="HEAD")).geturl() latest_from_head = _extract_version_tuple(resolved_url) current_version = _extract_version_tuple(__version__) if latest_from_head and current_version and current_version < latest_from_head: json_releases = json.loads((await _async_get(api_url)).read()) current_arch = QSysInfo().currentCpuArchitecture() if current_arch == "x86_64": win_version = "win64" elif current_arch == "i386": win_version = "win32" else: return (latest_from_head, url) latest_version = (0, 0, 0) latest_url = "" for release in json_releases: try: if release["draft"]: continue if release["prerelease"]: continue for asset in release["assets"]: if asset["name"].endswith(f"-{win_version}-setup.exe"): asset_version = _extract_version_tuple( release["tag_name"]) if asset_version > latest_version: latest_version = asset_version latest_url = asset["browser_download_url"] # In case something went wrong, still better to redirect to GitHub except (KeyError, TypeError): return (latest_from_head, url) if latest_version > current_version: return (latest_version, latest_url) return None
def system_info(self): sys_info = QSysInfo() fields = [ 'buildAbi', 'buildCpuArchitecture', 'currentCpuArchitecture', 'kernelType', 'kernelVersion', 'machineHostName', 'prettyProductName', 'productType', 'productVersion', ] info = [f'{field}: {getattr(sys_info, field)()}' for field in fields] info.append(f'QOS name: {QOperatingSystemVersion.current().name()}') info.append(f'sysconfig.get_platform(): {sysconfig.get_platform()}') info.append(f'QT: {QT_VERSION_STR}') info.append(f'PyQt version: {PYQT_VERSION_STR}') info.append(f'sip version: {SIP_VERSION_STR}') info.append(f'sys.platform: {sys.platform}') info.append(f'Python version: {sys.version}') return '\n'.join(info)
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 get_default_device(): return "".join([c for c in QSysInfo.productType() if DeviceName.regex.match(c)])
def createPanel(self): labelReportTitle = QLabel( self.translate("bugReport", "Bug Report Title: ")) self.lineEditReportTitle = QLineEdit() labelTestedEnvironment = QLabel( self.translate("bugReport", "Tested Environment: ")) self.lineEditTestedEnvironment = QLineEdit( self.translate( "bugReport", """System Platform:{}_{} Python Version:{}.{}.{}-{} PyQt Version:{} QT Version:{}""" ).format( QSysInfo.prettyProductName() if QSysInfo.prettyProductName() == "unknown" else "{}-{}".format(QSysInfo.kernelType(), QSysInfo.kernelVersion()), QSysInfo.currentCpuArchitecture(), sys.version_info.major, sys.version_info.minor, sys.version_info.micro, sys.version_info.releaselevel, PYQT_VERSION_STR, QT_VERSION_STR)) radioBtnQuickReport = QRadioButton( self.translate("bugReport", "Quick Report")) radioBtnKnowHowFix = QRadioButton( self.translate("bugReport", "Know How Fix")) radioBtnKnowHowFix.setChecked(True) radioBtnFeatureRequest = QRadioButton( self.translate("bugReport", "Feature Request")) buttonOpenHowReportBugURL = QPushButton( self.translate( "bugReport", """Click Me! Read "HOW REPORT A BUG" before report a bug.""")) self.buttonGroupBugReport = QButtonGroup() self.buttonGroupBugReport.addButton(radioBtnQuickReport) self.buttonGroupBugReport.addButton(radioBtnKnowHowFix) self.buttonGroupBugReport.addButton(radioBtnFeatureRequest) self.buttonGroupBugReport.addButton(buttonOpenHowReportBugURL) hboxRadiobutton = QHBoxLayout() hboxRadiobutton.addWidget(radioBtnKnowHowFix) hboxRadiobutton.addWidget(radioBtnQuickReport) hboxRadiobutton.addWidget(radioBtnFeatureRequest) hboxRadiobutton.addWidget(buttonOpenHowReportBugURL) hboxRadiobutton.addStretch() labelStepsToReproduce = QLabel( self.translate("bugReport", "Steps To Reproduce: ")) self.textEditStepsToReproduce = QTextEdit() labelActualresults = QLabel( self.translate("bugReport", "Actual results: ")) self.textEditActualresults = QTextEdit() self.textEditActualresults.insertPlainText( self.translate( "bugReport", "if have Python's Traceback, Please Paste.\nif is V2Ray-core JSON Editor issue, please Paste the JSON File without server information." )) self.textEditActualresults.setAcceptDrops(True) labelExpectedresults = QLabel( self.translate("bugReport", "Expected results: ")) self.textEditExpectedresults = QTextEdit() labelFeatureRequest = QLabel( self.translate("bugReport", "Feature Request: ")) self.textEditFeatureRequest = QTextEdit() labelQuickReport = QLabel(self.translate("bugReport", "Quick Report: ")) self.textEditQuickReport = QTextEdit() labelHowFix = QLabel(self.translate("bugReport", "How Fix: ")) self.textEditHowFix = QTextEdit() gridBoxReport = QGridLayout() gridBoxReport.addWidget(labelReportTitle, 0, 0) gridBoxReport.addWidget(self.lineEditReportTitle, 0, 1) gridBoxReport.addWidget(labelTestedEnvironment, 1, 0) gridBoxReport.addWidget(self.lineEditTestedEnvironment, 1, 1) gridBoxReport.addLayout(hboxRadiobutton, 2, 0, 1, 2) gridBoxQuickReport = QGridLayout() gridBoxQuickReport.addWidget(labelQuickReport, 0, 0) gridBoxQuickReport.addWidget(self.textEditQuickReport, 0, 1) self.groupBoxQuickReport = QGroupBox("", self) self.groupBoxQuickReport.setLayout(gridBoxQuickReport) self.groupBoxQuickReport.hide() gridBoxKnowHowFix = QGridLayout() gridBoxKnowHowFix.addWidget(labelStepsToReproduce, 0, 0) gridBoxKnowHowFix.addWidget(self.textEditStepsToReproduce, 0, 1) gridBoxKnowHowFix.addWidget(labelActualresults, 1, 0) gridBoxKnowHowFix.addWidget(self.textEditActualresults, 1, 1) self.buttonInsertPiture = QPushButton( self.translate("bugReport", "Insert Picture From URL:")) self.lineEditInserPiture = QLineEdit() gridBoxKnowHowFix.addWidget(self.lineEditInserPiture, 2, 1) gridBoxKnowHowFix.addWidget(self.buttonInsertPiture, 2, 0) gridBoxKnowHowFix.addItem(QSpacerItem(50, 50), 3, 0, 1, 4) gridBoxKnowHowFix.addWidget(labelExpectedresults, 4, 0) gridBoxKnowHowFix.addWidget(self.textEditExpectedresults, 4, 1) gridBoxKnowHowFix.addWidget(labelHowFix, 5, 0) gridBoxKnowHowFix.addWidget(self.textEditHowFix, 5, 1) self.groupBoxKnowHowFix = QGroupBox() self.groupBoxKnowHowFix.setLayout(gridBoxKnowHowFix) gridBoxFeatureRequest = QGridLayout() gridBoxFeatureRequest.addWidget(labelFeatureRequest, 0, 0) gridBoxFeatureRequest.addWidget(self.textEditFeatureRequest, 0, 1) self.groupBoxFeatureRequest = QGroupBox("", self) self.groupBoxFeatureRequest.setLayout(gridBoxFeatureRequest) self.groupBoxFeatureRequest.hide() hboxButton = QHBoxLayout() self.buttonExportBugReportText = QPushButton( self.translate("bugReport", "Export Bug Report Text")) self.buttonExitButReport = QPushButton( self.translate("bugReport", "Exit")) hboxButton.addStretch() hboxButton.addWidget(self.buttonExportBugReportText) hboxButton.addWidget(self.buttonExitButReport) vboxBugReport = QVBoxLayout(self) vboxBugReport.addLayout(gridBoxReport) vboxBugReport.addWidget(self.groupBoxQuickReport) vboxBugReport.addWidget(self.groupBoxKnowHowFix) vboxBugReport.addWidget(self.groupBoxFeatureRequest) vboxBugReport.addLayout(hboxButton) vboxBugReport.addStretch() self.settextEidtReadonly(result=True) self.createSignals()
def createStatusBar(self): sysinfo = QSysInfo() myMachine = "current CPU Architecture: " + sysinfo.currentCpuArchitecture( ) + " *** " + sysinfo.prettyProductName( ) + " *** " + sysinfo.kernelType() + " " + sysinfo.kernelVersion() self.statusBar().showMessage(myMachine, 0)
def isValidWinVer() -> bool: ver = QSysInfo.productVersion() return True if ver not in {'XP', 'Vista'} else False
logger.setLevel(logging.INFO) else: if args['debug']: logger = logging.getLogger('debug') logger.setLevel(logging.DEBUG) else: logger = logging.getLogger('production') logger.setLevel(logging.INFO) ch = logging.FileHandler('observer.log', 'w') ch.setLevel(logging.INFO) logger.addHandler(ch) app = QApplication(sys.argv) if platform.system() == 'Windows': if QSysInfo.windowsVersion() > QSysInfo.WV_WINDOWS7: QApplication.setStyle(QStyleFactory.create("Fusion")) else: QApplication.setStyle(QStyleFactory.create("Windows")) else: QApplication.setStyle(QStyleFactory.create("Windows")) app.setApplicationDisplayName("MQTT Observer") app.setApplicationName("MQTT Observer") app.setOrganizationDomain("xcape.io") app.setOrganizationName("xcape.io") if platform.system() == 'Windows': app.setAttribute(Qt.AA_EnableHighDpiScaling) # for 4K display translator = QTranslator()
def get_default_device(): device = QSysInfo.machineHostName() if device.lower() == "localhost": device = QSysInfo.productType() return "".join([c for c in device if DeviceName.regex.match(c)])
def __init__(self): # Set Application Variables self.appName = "novelWriter" self.appHandle = self.appName.lower() # Debug Settings self.showGUI = True # Allow blocking the GUI (disabled for testing) self.debugInfo = False # True if log level is DEBUG or VERBOSE # Config Error Handling self.hasError = False # True if the config class encountered an error self.errData = [] # List of error messages # Set Paths self.cmdOpen = None # Path from command line for project to be opened on launch self.confPath = None # Folder where the config is saved self.confFile = None # The config file name self.dataPath = None # Folder where app data is stored self.lastPath = None # The last user-selected folder (browse dialogs) self.appPath = None # The full path to the novelwriter package folder self.appRoot = None # The full path to the novelwriter root folder self.appIcon = None # The full path to the novelwriter icon file self.assetPath = None # The full path to the nw/assets folder self.themeRoot = None # The full path to the nw/assets/themes folder self.dictPath = None # The full path to the nw/assets/dict folder self.iconPath = None # The full path to the nw/assets/icons folder self.helpPath = None # The full path to the novelwriter .qhc help file # Runtime Settings and Variables self.confChanged = False # True whenever the config has chenged, false after save self.hasHelp = False # True if the Qt help files are present in the assets folder ## General self.guiTheme = "default" self.guiSyntax = "default_light" self.guiIcons = "typicons_colour_light" self.guiDark = False # Load icons for dark backgrounds, if available self.guiLang = "en" # Hardcoded for now since the GUI is only in English self.guiFont = "" # Defaults to system defualt font self.guiFontSize = 11 self.guiScale = 1.0 # Set automatically by Theme class ## Sizes self.winGeometry = [1100, 650] self.treeColWidth = [120, 30, 50] self.projColWidth = [140, 55, 140] self.mainPanePos = [300, 800] self.docPanePos = [400, 400] self.viewPanePos = [500, 150] self.outlnPanePos = [500, 150] self.isFullScreen = False ## Features self.hideVScroll = False # Hide vertical scroll bars on main widgets self.hideHScroll = False # Hide horizontal scroll bars on main widgets ## Project self.autoSaveProj = 60 # Interval for auto-saving project in seconds self.autoSaveDoc = 30 # Interval for auto-saving document in seconds ## Text Editor self.textFont = None # Editor font self.textSize = 12 # Editor font size self.textFixedW = True # Keep editor text fixed width self.textWidth = 600 # Editor text width self.textMargin = 40 # Editor/viewer text margin self.tabWidth = 40 # Editor tabulator width self.focusWidth = 800 # Focus Mode text width self.hideFocusFooter = False # Hide document footer in Focus Mode self.showFullPath = True # Show full document path in editor header self.autoSelect = True # Auto-select word when applying format with no selection self.doJustify = False # Justify text self.showTabsNSpaces = False # Show tabs and spaces in edior self.showLineEndings = False # Show line endings in editor self.doReplace = True # Enable auto-replace as you type self.doReplaceSQuote = True # Smart single quotes self.doReplaceDQuote = True # Smart double quotes self.doReplaceDash = True # Replace multiple hyphens with dashes self.doReplaceDots = True # Replace three dots with ellipsis self.scrollPastEnd = True # Allow scrolling past end of document self.autoScroll = False # Typewriter-like scrolling self.autoScrollPos = 30 # Start point for typewriter-like scrolling self.wordCountTimer = 5.0 # Interval for word count update in seconds self.bigDocLimit = 800 # Size threshold for heavy editor features in kilobytes self.highlightQuotes = True # Highlight text in quotes self.highlightEmph = True # Add colour to text emphasis ## User-Selected Symbols self.fmtApostrophe = nwUnicode.U_RSQUO self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO] self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO] ## Spell Checking self.spellTool = None self.spellLanguage = None ## Search Bar Switches self.searchCase = False self.searchWord = False self.searchRegEx = False self.searchLoop = False self.searchNextFile = False self.searchMatchCap = False ## Backup self.backupPath = "" self.backupOnClose = False self.askBeforeBackup = True ## State self.showRefPanel = True self.viewComments = True self.viewSynopsis = True # Check Qt5 Versions verQt = splitVersionNumber(QT_VERSION_STR) self.verQtString = QT_VERSION_STR self.verQtMajor = verQt[0] self.verQtMinor = verQt[1] self.verQtPatch = verQt[2] self.verQtValue = verQt[3] verQt = splitVersionNumber(PYQT_VERSION_STR) self.verPyQtString = PYQT_VERSION_STR self.verPyQtMajor = verQt[0] self.verPyQtMinor = verQt[1] self.verPyQtPatch = verQt[2] self.verPyQtValue = verQt[3] # Check Python Version self.verPyString = sys.version.split()[0] self.verPyMajor = sys.version_info[0] self.verPyMinor = sys.version_info[1] self.verPyPatch = sys.version_info[2] self.verPyHexVal = sys.hexversion # Check OS Type self.osType = sys.platform self.osLinux = False self.osWindows = False self.osDarwin = False self.osUnknown = False if self.osType.startswith("linux"): self.osLinux = True elif self.osType.startswith("darwin"): self.osDarwin = True elif self.osType.startswith("win32"): self.osWindows = True elif self.osType.startswith("cygwin"): self.osWindows = True else: self.osUnknown = True # Other System Info if self.verQtValue >= 50600: self.hostName = QSysInfo.machineHostName() self.kernelVer = QSysInfo.kernelVersion() else: self.hostName = "Unknown" self.kernelVer = "Unknown" # Packages self.hasEnchant = False # The pyenchant package self.hasAssistant = False # The Qt Assistant executable # Recent Cache self.recentProj = {} return
def get_platform_and_arch() -> Tuple[str, str]: return sys.platform, QSysInfo().currentCpuArchitecture()
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)
import sys, os, os.path, subprocess from functools import wraps from . import pyqt from .pyqt import * from PyQt5.QtCore import QSysInfo IS_TEST = 'pytest' in sys.modules IS_WINDOWS = os.platform() == 'Windows' IS_APPLE = os.platform() == 'Darwin' IS_IOS = not (not hasattr(QSysInfo, 'macVersion') or not QSysInfo.macVersion() & QSysInfo.MV_IOS)) IS_APPLE_DARK_MODE = False # you have to figure out a way to change this if possible. I did it in C++ if IS_IOS: HARDWARE_UUID = '<ios>' # no device-id protection required on iOS elif 'nt' in os.name: #s = subprocess.check_output('wmic csproduct get uid') #self.hardwareUUID = s.split('\n')[1].strip().decode('utf-8').strip() HARDWARE_UUID = subprocess.check_output('wmic csproduct get name,identifyingnumber,uuid').decode('utf-8').split()[-1] elif os.uname()[0] == 'Darwin': HARDWARE_UUID = subprocess.check_output("system_profiler SPHardwareDataType | awk '/UUID/ { print $3; }'", shell=True).decode('utf-8').strip() else: HARDWARE_UUID = None MACHINE_NAME = QSysInfo.machineHostName() ## ## Constants
def initConfig(self, confPath=None, dataPath=None): """Initialise the config class. The manual setting of confPath and dataPath is mainly intended for the test suite. """ logger.debug("Initialising Config ...") if confPath is None: confRoot = QStandardPaths.writableLocation( QStandardPaths.ConfigLocation) self.confPath = os.path.join(os.path.abspath(confRoot), self.appHandle) else: logger.info("Setting config from alternative path: %s" % confPath) self.confPath = confPath if dataPath is None: if self.verQtValue >= 50400: dataRoot = QStandardPaths.writableLocation( QStandardPaths.AppDataLocation) else: dataRoot = QStandardPaths.writableLocation( QStandardPaths.DataLocation) self.dataPath = os.path.join(os.path.abspath(dataRoot), self.appHandle) else: logger.info("Setting data path from alternative path: %s" % dataPath) self.dataPath = dataPath logger.verbose("Config path: %s" % self.confPath) logger.verbose("Data path: %s" % self.dataPath) self.confFile = self.appHandle + ".conf" self.lastPath = os.path.expanduser("~") self.appPath = getattr(sys, "_MEIPASS", os.path.abspath(os.path.dirname(__file__))) self.appRoot = os.path.abspath( os.path.join(self.appPath, os.path.pardir)) if os.path.isfile(self.appRoot): # novelWriter is packaged as a single file, so the app and # root paths are the same, and equal to the folder that # contains the single executable. self.appRoot = os.path.dirname(self.appRoot) self.appPath = self.appRoot # Assets self.assetPath = os.path.join(self.appPath, "assets") self.themeRoot = os.path.join(self.assetPath, "themes") self.dictPath = os.path.join(self.assetPath, "dict") self.iconPath = os.path.join(self.assetPath, "icons") self.appIcon = os.path.join(self.iconPath, "novelwriter.svg") # Internationalisation self.nwLangPath = os.path.join(self.appRoot, "i18n") logger.verbose("App path: %s" % self.appPath) logger.verbose("Last path: %s" % self.lastPath) # If config folder does not exist, create it. # This assumes that the os config folder itself exists. if not os.path.isdir(self.confPath): try: os.mkdir(self.confPath) except Exception as e: logger.error("Could not create folder: %s" % self.confPath) logException() self.hasError = True self.errData.append("Could not create folder: %s" % self.confPath) self.errData.append(str(e)) self.confPath = None # Check if config file exists if self.confPath is not None: if os.path.isfile(os.path.join(self.confPath, self.confFile)): # If it exists, load it self.loadConfig() else: # If it does not exist, save a copy of the default values self.saveConfig() # If data folder does not exist, make it. # This assumes that the os data folder itself exists. if self.dataPath is not None: if not os.path.isdir(self.dataPath): try: os.mkdir(self.dataPath) except Exception as e: logger.error("Could not create folder: %s" % self.dataPath) logException() self.hasError = True self.errData.append("Could not create folder: %s" % self.dataPath) self.errData.append(str(e)) self.dataPath = None # Host and Kernel if self.verQtValue >= 50600: self.hostName = QSysInfo.machineHostName() self.kernelVer = QSysInfo.kernelVersion() # Load recent projects cache self.loadRecentCache() # Check the availability of optional packages self._checkOptionalPackages() if self.spellTool is None: self.spellTool = nwConst.SP_INTERNAL if self.spellLanguage is None: self.spellLanguage = "en" # Check if local help files exist self.helpPath = os.path.join(self.assetPath, "help", "novelWriter.qhc") self.hasHelp = os.path.isfile(self.helpPath) self.hasHelp &= os.path.isfile( os.path.join(self.assetPath, "help", "novelWriter.qch")) logger.debug("Config initialisation complete") return True
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 get_default_device(): device = QSysInfo.machineHostName() if device.lower() == "localhost": device = QSysInfo.productType() return "".join([c for c in device if re.match(r"[\w\-]", c)])