def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('menu'))) pros = self.app.strings.properties self.editServersAction.setText(pros["editServers"]) self.importServerFromUrlAction.setText(pros["importServerFromUrl"]) self.copySelectedServerUrlAction.setText( pros["copySelectedServerUrlAction"]) self.showServerQRCodeAction.setText(pros["showServerQRCode"]) if len(self.app.guiConfig.guiConfig['serverList']) > 0: if self.app.guiConfig.guiConfig['settings']['selectedServerIndex'] > \ (len(self.app.guiConfig.guiConfig['serverList']) - 1): self.app.guiConfig.guiConfig['settings'][ 'selectedServerIndex'] = 0 self.app.guiConfig.write() self.app.systemTrayIconContextMenu.disconnectServer() self.app.systemTrayIcon.showMessage(pros["reset"], pros['resetSelectedIndex']) self.setServer(self.app.guiConfig.guiConfig['settings'] ['selectedServerIndex']) self.app.systemTrayIconContextMenu.connectServer() self.serverActions[self.app.guiConfig.guiConfig['settings']['selectedServerIndex']] \ .setIcon(Resources.getIconByFilename('baseline_check_black_18dp.png')) self.editServersAction.setIcon( Resources.getIconByFilename('none_black_18dp.png')) self.showServerQRCodeAction.triggered.connect(self.showServerQRCode) self.editServersAction.triggered.connect(self.editServers) self.importServerFromUrlAction.triggered.connect( self.importServerFromUrl) self.copySelectedServerUrlAction.triggered.connect( self.copySelectedServerUrl)
def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('menu'))) pros = self.app.strings.properties self.feedbackAction.setText(pros["feedback"]) self.aboutAction.setText(pros["about"]) self.feedbackAction.setIcon( Resources.getIconByFilename('none_black_18dp.png')) self.aboutAction.triggered.connect(self.aboutActionTriggered) self.feedbackAction.triggered.connect(self.feedbackActionTriggered)
def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('menu'))) pros = self.app.strings.properties # 根据配置初始化菜单 self.setStartBoot() self.setConnectAutomatically() self.setAllowOtherDevicesToConnect() connectAutomatically = self.guiConfig.guiConfig['settings'][ 'connectAutomatically'] if connectAutomatically: self.app.guiConfig.writeNewJsonFile('forwardServer', 'config.json') self.connectServer() server.start_pac_server(self.app.guiConfig.guiConfig['pac']['host'], self.app.guiConfig.guiConfig['pac']['port']) # 根据属性文件初始化菜单 self.helpAction.setText(pros['help']) self.allowOtherDevicesToConnectAction.setText( pros['allowOtherDevicesToConnectAction']) self.startBootAction.setText(pros['startBoot']) self.forwardProxyAction.setText(pros['forwardProxy']) self.pacAction.setText(pros['PAC']) self.serversAction.setText(pros['servers']) self.systemProxyAction.setText(pros['systemProxy']) self.connectAutomaticallyAction.setText(pros['connectAutomatically']) self.exitAction.setText(pros['exit']) # 绑定菜单 self.helpAction.setMenu(self.helpMenu) self.systemProxyAction.setMenu(self.systemProxyMenu) self.serversAction.setMenu(self.serversMenu) # 绑定信槽 self.connectAutomaticallyAction.triggered.connect( self.connectAutomaticallyActionTriggered) self.startBootAction.triggered.connect(self.startBootActionTriggered) self.allowOtherDevicesToConnectAction.triggered.connect( self.allowOtherDevicesToConnectActionTriggered) self.connectAndDisconnectAction.triggered.connect( self.connectAndDisconnectActionTriggered) self.exitAction.triggered.connect(self.exit)
def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('menu'))) # 根据配置初始化菜单 self.disableAction.setIcon( Resources.getIconByFilename('baseline_check_black_18dp.png')) # 根据属性文件初始化菜单 pros = self.app.strings.properties self.disableAction.setText(pros["disable"]) self.PACAction.setText(pros["pac"]) self.globalAction.setText(pros["global"]) # 绑定信槽 self.disableAction.triggered.connect(self.disableActionTriggered) self.PACAction.triggered.connect(self.PACActionTriggered) self.globalAction.triggered.connect(self.globalActionTriggered)
def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('window'))) # 根据配置文件初始化 if len(self.guiConfig.guiConfig['serverList']) == 0: self.add() else: for serverDetail in self.guiConfig.guiConfig['serverList']: print(serverDetail) item = QListWidgetItem() item.setText(f"{serverDetail['remarks']}") item.setIcon( Resources.getIconByFilename( 'baseline_public_black_18dp.png')) self.ui.listWidget.addItem(item) self.ui.listWidget.setCurrentRow(self.selectedServerIndex) self.setServer(self.guiConfig.guiConfig['serverList'][0]) # 绑定信槽 self.ui.addPushButton.clicked.connect(self.add) self.ui.addFromLinkPushButton.clicked.connect(self.addFromLink) self.ui.deletePushButton.clicked.connect(self.delete) self.ui.showQRCodePushButton.clicked.connect(self.showQRCode) self.ui.sharPushButton.clicked.connect(self.share) self.ui.listWidget.clicked.connect(self.listWidgetItemClicked) self.ui.protocolComboBox.currentIndexChanged.connect(self.setProtocol) self.ui.transportSettingsPushButton.clicked.connect( self.transportSettings) self.ui.savePushButton.clicked.connect(self.save) self.ui.cancelPushButton.clicked.connect(self.close) self.ui.resetPushButton.clicked.connect(self.reset) self.url = self.app.qrcodeMainWindow.serverToUrl( self.app.guiConfig.guiConfig['settings']['selectedServerIndex'])
def init(self): self.setStyleSheet( read_text_file(Resources.getResourcesPackagesPath('window')))