def main(): app = QApplication(sys.argv) import qdarkstyle # setup stylesheet app.setStyleSheet(qdarkstyle.load_stylesheet()) pixmap = QPixmap(os.path.join(_resourcepath('images'), "splash.png")) splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint) splash.setMask(pixmap.mask()) splash_font = splash.font() splash_font.setPixelSize(14) splash.setFont(splash_font) splash.show() splash.showMessage('Initialising...', Qt.AlignBottom | Qt.AlignLeft | Qt.AlignAbsolute, Qt.white) app.processEvents() """ for count in range(1, 6): splash.showMessage('Processing {0}...'.format(count), Qt.AlignBottom | Qt.AlignLeft, Qt.white) QApplication.processEvents() QThread.msleep(1000) """ frame = ConfiguratorWindow() frame.show_and_raise() splash.finish(frame) sys.exit(app.exec_())
def _put(self, res): """Put resource on widget""" label = QLabel() if "image" in res.mime: pixmap = QPixmap(res.file_path).scaledToWidth(100) label.setPixmap(pixmap) label.setMask(pixmap.mask()) else: label.setText(res.file_name) label.mouseReleaseEvent = partial(self.click, res) self.widget.widget().layout().addWidget(label) self.widget.show() self._resource_labels[res] = label self._res_hash[res.hash] = res res.in_content = False
def start(self): configs = {} configs['n'] = int(self.leSelectionSize.text()) configs['dimX1'] = int(self.leSizeX1.text()) configs['dimX2'] = int(self.leSizeX2.text()) configs['dimX3'] = int(self.leSizeX3.text()) configs['dimY'] = int(self.leSizeY.text()) configs['polynomType'] = self.cbPolynomType.currentIndex() configs['startdegX1'] = 0 configs['startdegX2'] = 0 configs['startdegX3'] = 0 configs['enddegX1'] = int(self.lePowerX1.text()) configs['enddegX2'] = int(self.lePowerX2.text()) configs['enddegX3'] = int(self.lePowerX3.text()) configs['weight'] = self.cbWeight.currentIndex() configs['lambda'] = self.cbThreeLambda.isChecked() configs['findBest'] = False configs['inputFile'] = self.leInputFile.text() solve.compute(configs) graphs = { 'Y' : 'y_all', 'X1' : 'x1_all', 'X2' : 'x2_all', 'X3' : 'x3_all', 'Error1' : 'err_1', 'Error1Norm' : 'err_1norm', 'Error2' : 'err_2', 'Error2Norm' : 'err_2norm', 'Y1' : 'y_1', 'Y1Norm' : 'y_1norm', 'Y2' : 'y_2', 'Y2Norm' : 'y_2norm', } for (k,v) in graphs.items(): graph = QPixmap('img_' + v + '.png') self.__getattribute__('lGraph' + k) self.__getattribute__('lGraph' + k).setPixmap(graph); self.__getattribute__('lGraph' + k).setMask(graph.mask()); results = open('results.txt').read() self.tOutput.setPlainText(results)
def __init__(self, res): QWidget.__init__(self) self.res = res layout = QVBoxLayout() self.setLayout(layout) preview = QLabel() if 'image' in res.mime: pixmap = QPixmap(res.file_path).scaledToWidth(32) else: info = QFileInfo(res.file_path) pixmap = QFileIconProvider().icon(info).pixmap(32, 32) preview.setPixmap(pixmap) preview.setMask(pixmap.mask()) preview.setMaximumHeight(32) label = QLabel() label.setText(res.file_name) layout.addWidget(preview) layout.addWidget(label) layout.setAlignment(Qt.AlignHCenter) self.setFixedWidth(64) self.setFixedHeight(64)
if self.donationButton.text() == 'Donate': self.copyEthAddressButton.setVisible(True) self.copyBtcAddressButton.setVisible(True) self.donationButton.setText('Hide') elif self.donationButton.text() == 'Hide': self.copyEthAddressButton.setVisible(False) self.copyBtcAddressButton.setVisible(False) self.donationButton.setText('Donate') self.worker.start() def cleanup(self): # Clears the clipboard of any copied text clip.setText('') form = MainWindow() # Define program window # Set up and display splash screen splashImage = QImage(splashByteArray) splashPixmap = QPixmap(splashImage) splashScr = QSplashScreen(splashPixmap, Qt.WindowStaysOnTopHint) splashScr.setMask(splashPixmap.mask()) splashScr.show() sleep(1) app.processEvents() splashScr.hide() splashScr.deleteLater() form.show() app.aboutToQuit.connect(form.cleanup) # Clears the clipboard when exiting app.exec_()
# if self.alpha > 0: # self.repaint() # if self.alpha == 0: # self.timer.stop() # #self.close() # def paintEvent(self,pe): # super(SplashScreen, self).paintEvent(pe) # p = QPainter(self) # p.fillRect(0,0,self.width(),self.height(), QColor(255,255,255,self.alpha)) pixmap = QPixmap(os.path.join(resource_dir,"client_splash.png")) splash = QSplashScreen(pixmap) splash.setMask(pixmap.mask()) # splash.setWindowFlags(Qt.WindowStaysOnTopHint) splash.show() splash_msg( u"{} - ".format(configuration.this_version) + _("Contacting updates server")) splash_msg( _("Loading database URL")) try: configuration.load_database_param() except Exception as e: mainlog.error(e) mainlog.error( "I was unable to get the DB URL from the server {}, so I'll continue with the file configuration".format( configuration.database_url_source)) showErrorBox( _("Can't connect to the main server"), _("I was unable to contact the main server (located here : {}). It is not 100% necessary to do so but that's not normal either. You should tell your administrator about that. I will now allow you to change the network address of the server I know in the preferences panel.").format( configuration.database_url_source))
import sys from PySide.QtCore import Qt from PySide.QtGui import QApplication, QPixmap, QSplashScreen from dialog.directory_dialog import DirectoryDialog from indexer.indexer import Indexer from gui.mainwindow import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) dir = DirectoryDialog() if dir.exec_() and dir.result() != "" and dir.result() != None: app.indexer = Indexer(dir.result()) splash_pix = QPixmap('res/SplashScreen.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() app.indexer.load_data() app.doclist = None app.webview = None app.currentWord = None app.mainWindow = MainWindow() splash.finish(app.mainWindow) app.mainWindow.show() sys.exit(app.exec_()) else: app.quit()