def openDialog(self): # Only single instance of Plugin if self.exists == True: return else: self.exists = True self.resources = Resources(self.plugin_dir) self.dlg = PlanHeatDMMDialog(self) self.data = Data(plugin=False) splash = QSplashScreen( QtGui.QPixmap(self.plugin_dir + os.path.sep + 'resources/PlanHeatPrincipal.png'), QtCore.Qt.WindowStaysOnTopHint) splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) splash.setEnabled(False) splash.show() # Run the dialog event loop self.run() splash.finish(self.dlg) self.dlg.show() result = self.dlg.exec_() self.exists = False # See if OK was pressed if result: # Do something useful here pass else: pass
def make_splash(): splash_pic = QPixmap('oncat/img/splash.png') splash = QSplashScreen(splash_pic, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(True) splash.show() return splash
def main(): import time os.chdir(civiltools_path) app = QtWidgets.QApplication(sys.argv) splash_pix = QPixmap("./images/civil-engineering.jpg") splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(False) # adding progress bar progressBar = QProgressBar(splash) progressBar.setMaximum(10) progressBar.setGeometry(50, splash_pix.height() - 30, splash_pix.width() - 100, 20) splash.show() splash.showMessage("<h1><font color='DarkRed'>civiltools by Ebrahim Raeyat Roknabadi </font></h1>", Qt.AlignCenter | Qt.AlignCenter, Qt.black) for i in range(1, 11): progressBar.setValue(i) t = time.time() while time.time() < t + 0.1: app.processEvents() # Simulate something that takes time time.sleep(1) # translator = QtCore.QTranslator() # translator.load("main_form.qm") # app.installTranslator(translator) window = FormWidget() window.setWindowTitle(_appname + ' ' + _version) window.show() splash.finish(window) sys.exit(app.exec_())
def run(self): """Run method that performs all the real work""" try: # locale.setlocale(locale.LC_ALL, 'en-GB') # Only single instance of Plugin if self.exists == True: return else: self.exists = True self.dlg = PlanHeatDMMDialog(self) self.resources = Resources(self.plugin_dir) self.data = Data(plugin=True) # Name of project self.data.projectName = master_mapping_config.CURRENT_PROJECT_NAME # Redirection dmm_folder = os.path.join(master_mapping_config.CURRENT_MAPPING_DIRECTORY, master_mapping_config.DMM_FOLDER) os.makedirs(dmm_folder, exist_ok=True) self.data.outputSaveFile = os.path.join(dmm_folder, master_mapping_config.DMM_PREFIX) splash = QSplashScreen(QtGui.QPixmap(self.plugin_dir + os.path.sep + 'resources/PlanHeatPrincipal.png'), QtCore.Qt.WindowStaysOnTopHint) splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) splash.setEnabled(False) splash.show() # Run the dialog event loop initWindowStatus(self) self.resources.loadAppResources() initWindowbehavior(self) # Deserialize the module DMMSerializer.deserialize(self) splash.finish(self.dlg) # show the dialog self.dlg.show() # Run the dialog event loop result = self.dlg.exec_() self.exists = False # See if OK was pressed if result: # Do something useful here - pass else: pass except Exception as e: self.exists = False print(str(e))
def main(): app = QApplication(sys.argv) app.setStyle("Fusion") app.setStyleSheet("QPushButton { margin: 200ex; }") dark_palette = QPalette() dark_palette.setColor(QPalette.Window, QColor(53, 53, 53)) dark_palette.setColor(QPalette.WindowText, Qt.white) dark_palette.setColor(QPalette.Base, QColor(25, 25, 25)) dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ToolTipBase, Qt.white) dark_palette.setColor(QPalette.ToolTipText, Qt.white) dark_palette.setColor(QPalette.Text, Qt.white) dark_palette.setColor(QPalette.Button, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ButtonText, Qt.white) dark_palette.setColor(QPalette.BrightText, Qt.red) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, Qt.black) app.setPalette(dark_palette) splash_pix = QPixmap('splash.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(False) progressBar = QProgressBar(splash) progressBar.setMaximum(10) progressBar.setGeometry(0, splash_pix.height() - 50, splash_pix.width(), 20) splash.show() splash.showMessage("<h1><font color='green'>Welcome!</font></h1>", Qt.AlignTop | Qt.AlignCenter, Qt.black) for i in range(1, 11): progressBar.setValue(i) t = time.time() while time.time() < t + 0.1: app.processEvents() time.sleep(2) splash.close() controller = Controller() controller.show_first() sys.exit(app.exec_())
def run(argv): app = QApplication(argv) import argparse parser = argparse.ArgumentParser(description='Run Farseer') parser.add_argument('--config', metavar='path', required=False, help='Farseer Configuration File') splash_file = os.path.join(os.pardir, 'gui', 'images', 'splash-screen.png') splash_pix = QtGui.QPixmap(splash_file) args = parser.parse_args() splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) splash.setEnabled(False) splash.show() screen_resolution = app.desktop().screenGeometry() gui_settings, stylesheet = gui_utils.deliver_settings(screen_resolution) ex = Main(gui_settings=gui_settings, config=args.config) splash.finish(ex) font_file = os.path.join(os.pardir, 'gui', 'SinkinSans', 'SinkinSans-400Regular.otf') font_id = QtGui.QFontDatabase.addApplicationFont(font_file) app.setStyleSheet(stylesheet) ex.show() ex.raise_() execution = app.exec_() del ex del app sys.exit(execution) return
sub = host.split(".") subnet = sub[0] + "." + sub[1] + "." + sub[2] array = [host, subnet] return array if __name__ == '__main__': app = QApplication(sys.argv) #--- setting darkstyle sheet on main window dark_stylesheet = qdarkstyle.load_stylesheet_pyqt5() app.setStyleSheet(dark_stylesheet) #--- splash process splash_pix = QPixmap('logo.ico') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(False) progressBar = QProgressBar(splash) progressBar.setGeometry(0, splash_pix.height() - 50, splash_pix.width(), 20) splash.show() splash.showMessage( "<h1><font color='green'>Coinpaign Scanning...</font></h1>", Qt.AlignTop | Qt.AlignCenter, Qt.black) #------------------- ex = App() sys.exit(app.exec_())
def __init__(self): super(QMainWindow, self).__init__() # Set up the user interface from Designer. self.setupUi(self) self.setAccessibleName("Hive Desktop") self.redrawLock = Lock() self.updateLock = Lock() self.optionsDialog = dialogs.Options(self) self.aboutDialog = dialogs.About( self, copyright='holger80', programName='Hive Desktop', version=VERSION, website='https://github.com/holgern/hivedesktop', websiteLabel='Github', comments= '"Welcome to Hive desktop!\n This is the first release for testing qt5.\n Please vote for holger80 as witness, if you like this :).', licenseName='GPL-3.0', # licenseUrl=helpers.joinpath_to_cwd('LICENSE').as_uri(), authors=('holger80', ), # dependencies=[l.strip() for l in requirements.readlines()], ) self.mdrenderer = MDRenderer(str(helpers.joinpath_to_cwd('themes'))) # tmpfile = helpers.mktemp(prefix='hivedesktop', suffix='.html') self.post = {"body": "##test", "authorperm": "@test/test"} self.thread = threads.MDThread(self) # self.webview.url = tmpfile.as_uri() self.feedListWidget.currentRowChanged.connect( self.change_displayed_post, Qt.QueuedConnection) self.timer = QTimer() self.timer.timeout.connect(self.refresh_account_thread) self.timer2 = QTimer() self.timer2.timeout.connect(self.update_account_hist_thread) self.timer3 = QTimer() self.timer3.timeout.connect(self.update_account_feed_thread) self.cache_path = QStandardPaths.writableLocation( QStandardPaths.CacheLocation) self.db_type = "shelve" self.feed = [] self.post = None # Get settings settings = QSettings() # Get checkbox state with speciying type of checkbox: # type=bool is a replacement of toBool() in PyQt5 check_state = settings.value(SETTINGS_TRAY, True, type=bool) hist_info_check_state = settings.value(SETTINGS_HIST_INFO, True, type=bool) account_state = settings.value(SETTINGS_ACCOUNT, "", type=str) # Set state self.accountHistNotificationCheckBox.setChecked(hist_info_check_state) self.autoRefreshCheckBox.setChecked(check_state) if check_state: self.timer.start(5000) self.timer2.start(15000) self.timer3.start(60000) self.accountLineEdit.setText(account_state) # connect the slot to the signal by clicking the checkbox to save the state settings self.autoRefreshCheckBox.clicked.connect(self.save_check_box_settings) self.accountHistNotificationCheckBox.clicked.connect( self.save_check_box_settings) self.accountLineEdit.editingFinished.connect( self.save_account_settings) self.actionAbout.triggered.connect(self.about) self.actionOptions.triggered.connect(self.options) self.threadpool = QThreadPool() self.minimizeAction = QAction("Mi&nimize", self, triggered=self.hide) self.maximizeAction = QAction("Ma&ximize", self, triggered=self.showMaximized) self.restoreAction = QAction("&Restore", self, triggered=self.showNormal) menu = QMenu() menu.addAction(self.minimizeAction) menu.addAction(self.maximizeAction) menu.addAction(self.restoreAction) menu.addSeparator() # aboutAction = menu.addAction("about") # aboutAction.triggered.connect(self.about) exitAction = menu.addAction("Exit") exitAction.triggered.connect(self.closeApp) self.tray = QSystemTrayIcon(QIcon(':/icons/icon.ico')) self.tray.setContextMenu(menu) self.tray.setToolTip("Hive Desktop!") self.tray.setObjectName("Hive Desktop") self.setWindowTitle("Hive Desktop") self.tray.show() splash_pix = QPixmap(':/icons/splash.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(False) splash.show() splash.showMessage("<h1><font color='green'>starting...</font></h1>", Qt.AlignTop | Qt.AlignCenter, Qt.black) account = account_state nodelist = NodeList() nodelist.update_nodes() self.stm = Steem(node=nodelist.get_nodes(hive=True)) if account != "": try: self.hist_account = Account(account, steem_instance=self.stm) except: self.hist_account = None else: self.hist_account = None if self.hasFocus is not None: self.init_new_account() # self.button.clicked.connect(lambda: self.text.setText(_get_quote(self.hist_account, self.stm))) self.refreshPushButton.clicked.connect(self.refresh_account_thread) self.refreshPushButton.clicked.connect(self.update_account_hist_thread) self.accountLineEdit.editingFinished.connect(self.update_account_info) splash.deleteLater() self.tray.showMessage("Ready", "Account history loaded!")
class proxyMaker(QWidget): DEFAULT_LOC = 'ord1' def __init__(self): super().__init__() self.initUI() self.initSplashScreen() def initUI(self): serverNames = ['GigaNet', 'UpCloud', 'Vultr', 'NetNut'] actionNames = ['Create', 'Info', 'Destroy', 'Save and Quit'] # Input Horizontal hbox = QVBoxLayout(self) splitter = QSplitter(self) splitter.setOrientation(Qt.Vertical) # Top Horizontal top = QFrame(splitter) top.setFrameShape(QFrame.StyledPanel) # Bottom Horizontal bottom = QFrame(splitter) bottom.setFrameShape(QFrame.StyledPanel) # Inputs # Server, NumberProxies, Location, Action inputBox = QHBoxLayout(top) serverSplitter = QSplitter(top) serverSplitter.setOrientation(Qt.Horizontal) numberSplitter = QSplitter(top) numberSplitter.setOrientation(Qt.Horizontal) locationSplitter = QSplitter(top) locationSplitter.setOrientation(Qt.Horizontal) actionSplitter = QSplitter(top) actionSplitter.setOrientation(Qt.Horizontal) # Server, NumberProxies, Location, Action Verticals serverBox = QFrame(serverSplitter) serverBox.setFrameShape(QFrame.StyledPanel) numberBox = QFrame(numberSplitter) numberBox.setFrameShape(QFrame.StyledPanel) locationBox = QFrame(locationSplitter) locationBox.setFrameShape(QFrame.StyledPanel) actionBox = QFrame(actionSplitter) actionBox.setFrameShape(QFrame.StyledPanel) ### Server self.serverLayout = QVBoxLayout(serverBox) self.serverButtons = [QPushButton(x) for x in serverNames] [x.setCheckable(True) for x in self.serverButtons] self.serverButtonsGroup = QButtonGroup() [self.serverButtonsGroup.addButton(x) for x in self.serverButtons] self.serverButtonsGroup.setExclusive(True) self.serverButtons[0].clicked.connect(self.giganet) self.serverButtons[1].clicked.connect(self.upcloud) self.serverButtons[2].clicked.connect(self.vultr) self.serverButtons[3].clicked.connect(self.netnut) # Number and Location Box generalInfoLayout = QVBoxLayout(numberBox) self.numberDisplay = QPlainTextEdit() self.numberDisplay.setPlaceholderText("Number of proxies.") self.locationDisplay = QPlainTextEdit() self.locationDisplay.setPlaceholderText("Location of proxies.") # Server specific requirements specificInfoLayout = QVBoxLayout(locationBox) self.gigaInfo = ['APIKEY', 'APIHASH'] self.gigaInfo[0] = QPlainTextEdit() self.gigaInfo[0].setPlaceholderText("GigaNet API KEY.") self.gigaInfo[0].setVisible(False) self.gigaInfo[1] = QPlainTextEdit() self.gigaInfo[1].setPlaceholderText("GigaNet API HASH.") self.gigaInfo[1].setVisible(False) self.ucInfo = ['ucUSR', 'ucPSWD'] self.ucInfo[0] = QPlainTextEdit() self.ucInfo[0].setPlaceholderText("UpCloud Username.") self.ucInfo[0].setVisible(False) self.ucInfo[1] = QPlainTextEdit() self.ucInfo[1].setPlaceholderText("UpCloud Password.") self.ucInfo[1].setVisible(False) self.vInfo = ['vtoken'] self.vInfo[0] = QPlainTextEdit() self.vInfo[0].setPlaceholderText("Vultr.") self.vInfo[0].setVisible(False) self.nnInfo = ['nnUSR', 'nnPSWD'] self.nnInfo[0] = QPlainTextEdit() self.nnInfo[0].setPlaceholderText("NetNut Username.") self.nnInfo[0].setVisible(False) self.nnInfo[1] = QPlainTextEdit() self.nnInfo[1].setPlaceholderText("NetNut Password.") self.nnInfo[1].setVisible(False) # Action Box self.actionLayout = QVBoxLayout(actionBox) self.actionButtons = [QPushButton(x) for x in actionNames] [x.setCheckable(True) for x in self.actionButtons] self.actionButtonsGroup = QButtonGroup() [self.actionButtonsGroup.addButton(x) for x in self.actionButtons] self.actionButtonsGroup.setExclusive(True) self.actionButtons[0].clicked.connect(self.create) self.actionButtons[1].clicked.connect(self.info) self.actionButtons[2].clicked.connect(self.destroy) self.actionButtons[3].clicked.connect(self.quit) # Output # Log, Verticals outputBox = QHBoxLayout(bottom) logSplitter = QSplitter(bottom) logSplitter.setOrientation(Qt.Horizontal) proxySplitter = QSplitter(bottom) proxySplitter.setOrientation(Qt.Horizontal) # Log, Proxy Verticals logBox = QFrame(logSplitter) logBox.setFrameShape(QFrame.StyledPanel) proxyBox = QFrame(proxySplitter) proxyBox.setFrameShape(QFrame.StyledPanel) # Log logLayout = QVBoxLayout(logBox) self.logDisplay = QPlainTextEdit() self.logDisplay.setReadOnly(True) self.logDisplay.setPlainText("Log will display here.") # Proxy proxyLayout = QVBoxLayout(proxyBox) self.proxyDisplay = QPlainTextEdit() self.proxyDisplay.setPlainText("Proxies:") self.proxyDisplay.setReadOnly(True) # Add widgets into layout [self.serverLayout.addWidget(x) for x in self.serverButtons] [self.actionLayout.addWidget(x) for x in self.actionButtons] generalInfoLayout.addWidget(self.numberDisplay) generalInfoLayout.addWidget(self.locationDisplay) [ specificInfoLayout.addWidget(self.gigaInfo[i]) for i in range(len(self.gigaInfo)) ] [ specificInfoLayout.addWidget(self.ucInfo[i]) for i in range(len(self.ucInfo)) ] [ specificInfoLayout.addWidget(self.vInfo[i]) for i in range(len(self.vInfo)) ] [ specificInfoLayout.addWidget(self.nnInfo[i]) for i in range(len(self.nnInfo)) ] logLayout.addWidget(self.logDisplay) proxyLayout.addWidget(self.proxyDisplay) inputBox.addWidget(serverSplitter) inputBox.addWidget(numberSplitter) inputBox.addWidget(locationSplitter) inputBox.addWidget(actionSplitter) outputBox.addWidget(logSplitter) outputBox.addWidget(proxySplitter) hbox.addWidget(splitter) # Restore Information from data/info.txt if exists if os.path.isfile("data/info.txt"): print("Info.txt found.") with open("data/info.txt") as fh: data = json.load(fh) for dataHandler in data['giganet']: self.gigaInfo[0].setPlainText(dataHandler['apikey']) self.gigaInfo[1].setPlainText(dataHandler['apihash']) for dataHandler in data['upcloud']: self.ucInfo[0].setPlainText(dataHandler['ucuser']) self.ucInfo[1].setPlainText(dataHandler['ucpass']) for dataHandler in data['vultr']: self.vInfo[0].setPlainText(dataHandler['vtoken']) for dataHandler in data['netnut']: self.nnInfo[0].setPlainText(dataHandler['nnuser']) self.nnInfo[1].setPlainText(dataHandler['nnpass']) def initSplashScreen(self): splash_pix = QPixmap('data/image/loading.jpg') self.splash = QSplashScreen(splash_pix) self.splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) self.splash.setEnabled(False) def giganet(self): print("Giganet") [self.gigaInfo[i].setVisible(True) for i in range(len(self.gigaInfo))] [self.ucInfo[i].setVisible(False) for i in range(len(self.ucInfo))] [self.vInfo[i].setVisible(False) for i in range(len(self.vInfo))] [self.nnInfo[i].setVisible(False) for i in range(len(self.nnInfo))] self.locationDisplay.setDisabled(False) def upcloud(self): print("UpCloud") [self.gigaInfo[i].setVisible(False) for i in range(len(self.gigaInfo))] [self.ucInfo[i].setVisible(True) for i in range(len(self.ucInfo))] [self.vInfo[i].setVisible(False) for i in range(len(self.vInfo))] [self.nnInfo[i].setVisible(False) for i in range(len(self.nnInfo))] self.locationDisplay.setDisabled(False) def vultr(self): print("Vultr") [self.gigaInfo[i].setVisible(False) for i in range(len(self.gigaInfo))] [self.ucInfo[i].setVisible(False) for i in range(len(self.ucInfo))] [self.vInfo[i].setVisible(True) for i in range(len(self.vInfo))] [self.nnInfo[i].setVisible(False) for i in range(len(self.nnInfo))] self.locationDisplay.setDisabled(False) def netnut(self): print("NetNut") [self.gigaInfo[i].setVisible(False) for i in range(len(self.gigaInfo))] [self.ucInfo[i].setVisible(False) for i in range(len(self.ucInfo))] [self.vInfo[i].setVisible(False) for i in range(len(self.vInfo))] [self.nnInfo[i].setVisible(True) for i in range(len(self.nnInfo))] self.locationDisplay.setDisabled(True) def enableAll(self): # Enable all buttons and text boxes [x.setDisabled(False) for x in self.serverButtons] [x.setDisabled(False) for x in self.actionButtons] self.numberDisplay.setDisabled(False) self.locationDisplay.setDisabled(False) [ self.gigaInfo[i].setDisabled(False) for i in range(len(self.gigaInfo)) ] [self.ucInfo[i].setDisabled(False) for i in range(len(self.ucInfo))] [self.vInfo[i].setDisabled(False) for i in range(len(self.vInfo))] [self.nnInfo[i].setDisabled(False) for i in range(len(self.nnInfo))] self.logDisplay.setDisabled(False) self.proxyDisplay.setDisabled(False) def disableAll(self): # Disable all buttons and text boxes [x.setDisabled(True) for x in self.serverButtons] [x.setDisabled(True) for x in self.actionButtons] self.numberDisplay.setDisabled(True) self.locationDisplay.setDisabled(True) [self.gigaInfo[i].setDisabled(True) for i in range(len(self.gigaInfo))] [self.ucInfo[i].setDisabled(True) for i in range(len(self.ucInfo))] [self.vInfo[i].setDisabled(True) for i in range(len(self.vInfo))] [self.nnInfo[i].setDisabled(True) for i in range(len(self.nnInfo))] self.logDisplay.setDisabled(True) self.proxyDisplay.setDisabled(True) def threadHelper(self, func, args, res): res.append(func(*args)) def threadHelperNoArgs(self, func): func() def create(self): print("Create") if self.serverButtons[0].isChecked() \ and len(self.numberDisplay.toPlainText()) != 0 \ and len(self.locationDisplay.toPlainText()) != 0: print("Giga create") numProxies = self.numberDisplay.toPlainText() serverLocation = self.locationDisplay.toPlainText() gigaKey = self.gigaInfo[0].toPlainText() gigaHash = self.gigaInfo[1].toPlainText() self.logDisplay.setPlainText("Giganet chosen. Creating ...") self.logDisplay.appendPlainText( "Number of Proxies: {}".format(numProxies)) self.logDisplay.appendPlainText( "Server Location: {}".format(serverLocation)) # Mutliple Gigenet accounts (key, hash) split by ',' if ',' in gigaKey or ',' in gigaHash: gigaKey = gigaKey.split(",") gigaHash = gigaHash.split(",") else: gigaKey = [gigaKey] gigaHash = [gigaHash] keyHash = {} for i in range(0, len(gigaKey)): keyHash["gigaKey{0}".format(i)] = ( gigaKey[i], gigaHash[i], ) self.taskGigaCreate(i, keyHash, numProxies, serverLocation) elif self.serverButtons[1].isChecked() \ and len(self.numberDisplay.toPlainText()) != 0: print("Upcloud create") numProxies = self.numberDisplay.toPlainText() ucUsr = self.ucInfo[0].toPlainText() ucPswd = self.ucInfo[1].toPlainText() self.logDisplay.setPlainText("UpCloud chosen. Creating ...") self.logDisplay.appendPlainText( "Number of Proxies: {}".format(numProxies)) self.logDisplay.appendPlainText( "Server Location preset as us-chi1 ") res = [] ucApiInit(ucUsr, ucPswd) thread = threading.Thread(target=self.threadHelper, args=(ucApiCreate, (numProxies, ), res)) thread.start() thread.join() # Show splash screen when thread is still running. stillAlive = 0 while thread.is_alive(): if not stillAlive: self.splash.show() self.disableAll() # When QSplashScreen is running, there should be an event loop running # processEvents forces app to process all events app.processEvents() stillAlive = 1 self.splash.close() self.enableAll() logFile, infoFile = ucApiReturnFileName() logThread = displayOutput(logFile, self.logDisplay) proxyThread = displayOutput(infoFile, self.proxyDisplay) elif self.serverButtons[2].isChecked() \ and len(self.numberDisplay.toPlainText()) != 0 \ and len(self.locationDisplay.toPlainText()) != 0: print("Vultr") elif self.serverButtons[3].isChecked() \ and len(self.numberDisplay.toPlainText()) != 0: print("NetNut") numProxies = self.numberDisplay.toPlainText() self.logDisplay.setPlainText("NetNut chosen. Creating ...") self.logDisplay.appendPlainText( "Number of Proxies: {}".format(numProxies)) nnUsername = self.nnInfo[0].toPlainText() nnPassword = self.nnInfo[1].toPlainText() # Run API function in a thread and return value store in res. res = [] nnApiInit() thread = threading.Thread(target=self.threadHelper, args=(nnApiCreate, ( numProxies, nnUsername, nnPassword, ), res)) thread.start() # Show splash screen when thread is still running. stillAlive = 0 while thread.is_alive(): if not stillAlive: self.splash.show() self.disableAll() # When QSplashScreen is running, there should be an event loop running # processEvents forces app to process all events app.processEvents() stillAlive = 1 self.splash.close() self.enableAll() logFile, infoFile = nnApiReturnFileName() logThread = displayThread(logFile, self.logDisplay) proxyThread = displayThread(infoFile, self.proxyDisplay) logThread.start() proxyThread.start() else: print("Check input") def info(self): print("Info") if self.serverButtons[0].isChecked(): print("Giga Info") serverLocation = self.locationDisplay.toPlainText() gigaKey = self.gigaInfo[0].toPlainText() gigaHash = self.gigaInfo[1].toPlainText() self.logDisplay.setPlainText("Giganet chosen. Getting Info ...") # Mutliple Gigenet accounts (key, hash) split by ',' if ',' in gigaKey or ',' in gigaHash: gigaKey = gigaKey.split(",") gigaHash = gigaHash.split(",") else: gigaKey = [gigaKey] gigaHash = [gigaHash] keyHash = {} for i in range(0, len(gigaKey)): keyHash["gigaKey{0}".format(i)] = ( gigaKey[i], gigaHash[i], ) self.taskGigaInfo(i, keyHash, serverLocation) else: print("Check input") def destroy(self): print("Destroy") if self.serverButtons[0].isChecked(): print("Giga destroy") self.logDisplay.setPlainText("Giganet chosen. Destroying ...") serverLocation = self.locationDisplay.toPlainText() gigaKey = self.gigaInfo[0].toPlainText() gigaHash = self.gigaInfo[1].toPlainText() # Mutliple Gigenet accounts (key, hash) split by ',' if ',' in gigaKey or ',' in gigaHash: gigaKey = gigaKey.split(",") gigaHash = gigaHash.split(",") else: gigaKey = [gigaKey] gigaHash = [gigaHash] keyHash = {} for i in range(0, len(gigaKey)): keyHash["gigaKey{0}".format(i)] = ( gigaKey[i], gigaHash[i], ) self.taskGigaDestroy(i, keyHash, serverLocation) elif self.serverButtons[1].isChecked(): print("Upcloud destroy") ucUsr = self.ucInfo[0].toPlainText() ucPswd = self.ucInfo[1].toPlainText() self.logDisplay.setPlainText("UpCloud chosen. destroy ...") res = [] ucApiInit(ucUsr, ucPswd) ucApiDestroy() logFile, infoFile = ucApiReturnFileName() logThread = displayOutput(logFile, self.logDisplay) proxyThread = displayOutput(infoFile, self.proxyDisplay) else: print("Check input") if sys.platform == 'linux': os.system("rm *.txt") def quit(self): data = {} data['giganet'] = [] data['giganet'].append({ 'apikey': self.gigaInfo[0].toPlainText(), 'apihash': self.gigaInfo[1].toPlainText() }) data['upcloud'] = [] data['upcloud'].append({ 'ucuser': self.ucInfo[0].toPlainText(), 'ucpass': self.ucInfo[1].toPlainText() }) data['vultr'] = [] data['vultr'].append({'vtoken': self.vInfo[0].toPlainText()}) data['netnut'] = [] data['netnut'].append({ 'nnuser': self.nnInfo[0].toPlainText(), 'nnpass': self.nnInfo[1].toPlainText() }) with open('data/info.txt', 'w') as fh: json.dump(data, fh) QApplication.quit() def taskGigaCreate(self, idx, keyHashDict, numProxies, serverLocation): keyHash = keyHashDict["gigaKey{0}".format(idx)] print("[DEBUG] Runnning {}: {} | {} | {} | {} | {}".format( idx, keyHashDict["gigaKey{0}".format(idx)], keyHash[0], keyHash[1], numProxies, serverLocation)) # Run API function in a thread and return value store in res. res = [] gigaApiInit(serverLocation, keyHash[0], keyHash[1]) thread = threading.Thread(target=self.threadHelper, args=(gigaApiCreate, ( numProxies, serverLocation, ), res)) thread.start() thread.join() # Show splash screen when thread is still running. stillAlive = 0 while thread.is_alive(): if not stillAlive: self.splash.show() self.disableAll() # When QSplashScreen is running, there should be an event loop running # processEvents forces app to process all events app.processEvents() stillAlive = 1 self.splash.close() self.enableAll() logFile, infoFile = gigaApiReturnFileName() logThread = displayOutput(logFile, self.logDisplay) proxyThread = displayOutput(infoFile, self.proxyDisplay) def taskGigaInfo(self, idx, keyHashDict, serverLocation): keyHash = keyHashDict["gigaKey{0}".format(idx)] print("[DEBUG]Runnning {}: {} | {} | {} | {}".format( idx, keyHashDict["gigaKey{0}".format(idx)], keyHash[0], keyHash[1], serverLocation)) gigaApiInit(serverLocation, keyHash[0], keyHash[1]) # Run API function in a thread and return value store in res. thread = threading.Thread(target=self.threadHelperNoArgs, args=(gigaApiInfo, )) thread.start() # Show splash screen when thread is still running. stillAlive = 0 while thread.is_alive(): if not stillAlive: self.splash.show() self.disableAll() # When QSplashScreen is running, there should be an event loop running # processEvents forces app to process all events app.processEvents() stillAlive = 1 self.splash.close() self.enableAll() logFile, infoFile = gigaApiReturnFileName() logThread = displayOutput(logFile, self.logDisplay) proxyThread = displayOutput(infoFile, self.proxyDisplay) def taskGigaDestroy(self, idx, keyHashDict, serverLocation=DEFAULT_LOC): keyHash = keyHashDict["gigaKey{0}".format(idx)] print("[DEBUG] Runnning {}: {} | {} | {} | {}".format( idx, keyHashDict["gigaKey{0}".format(idx)], keyHash[0], keyHash[1], serverLocation)) gigaApiInit(serverLocation, keyHash[0], keyHash[1]) # Run API function in a thread and return value store in res. thread = threading.Thread(target=self.threadHelperNoArgs, args=(gigaApiDestroy, )) thread.start() # Show splash screen when thread is still running. stillAlive = 0 while thread.is_alive(): if not stillAlive: self.splash.show() self.disableAll() # When QSplashScreen is running, there should be an event loop running # processEvents forces app to process all events app.processEvents() stillAlive = 1 self.splash.close() self.enableAll() logFile, infoFile = gigaApiReturnFileName() logThread = displayOutput(logFile, self.logDisplay)