def finished_start(self): self.save_settings() self.start_button.setText("Start") self.setEnabled(True) self.setStatusTip("Ready") if self.working_thread.mbox: data = self.working_thread.mbox mbox = QMessageBox(self) mbox.setWindowTitle(data[0]) mbox.setIcon(data[1]) mbox.setWindowIcon(data[2]) mbox.setText(data[3]) if data[4]: mbox.setDetailedText(data[4]) mbox.exec() # TODO: NEED TO FIX! if self.working_thread.updates: d = TableDialog(self.working_thread.updates, self.working_thread.streetdb) d.exec() else: mbox = QMessageBox(self) mbox.setWindowTitle("Done!") if self.working_thread.updates: mbox.setText("Program is done! {} updated!" .format(len(self.working_thread.updates))) else: mbox.setText("Program is done! Everything was up to date!") mbox.setIcon(QMessageBox.Information) mbox.exec()
def error_message(text): errorbox = QMessageBox() errorbox.setWindowIcon(QPixmap("../icons/desuratools_256.png")) errorbox.setWindowTitle("Error") errorbox.setText(text) errorbox.setIcon(QMessageBox.Critical) return errorbox
def start(self): incomplete = [] if self.google_radio.isChecked(): if not self.username.text(): incomplete.append(self.username) if not self.password.text(): incomplete.append(self.password) if not self.document_id.text(): incomplete.append(self.document_id) elif not self.csv_file.text(): incomplete.append(self.csv_file) if not self.dbf_file.text(): incomplete.append(self.dbf_file) if len(incomplete) > 0: mbox = QMessageBox(self) mbox.setWindowTitle("Warning, incomplete fields!") mbox.setIcon(QMessageBox.Warning) mbox.setWindowIcon(QIcon.fromTheme("dialog-warning")) mbox.setText("%d fields are incomplete" % len(incomplete)) mbox.exec() for field in self.changed_styles: field.setStyleSheet("") for field in incomplete: field.setStyleSheet("border: 1.5px solid red; border-radius: 5px") self.changed_styles = incomplete.copy() return for field in self.changed_styles: field.setStyleSheet("") self.setStatusTip("Working...") self.working_thread = WorkThread(self) self.working_thread.finished.connect(self.finished_start) self.working_thread.start()
def winsetup(self): msgbox = QMessageBox(self) msgbox.setWindowIcon(QIcon('img/note.png')) msgbox.resize(300, 80) msgbox.setWindowTitle('ADLMIDI pyGUI') text = "<center><b>ADLMIDI cannot be found!</b></center><br>" + "Please check that " + "<b>" + binary + "</b>" + " is in the same folder as this program." msgbox.setText(text) msgbox.show()
def user_choice(text, windowtitle, icon, acceptbutton="OK"): choice_dialog = QMessageBox() choice_dialog.setWindowIcon(QPixmap("../icons/desuratools_256.png")) choice_dialog.setText(text) choice_dialog.setIcon(icon) choice_dialog.setStandardButtons(QMessageBox.Cancel) choice_dialog.setWindowTitle(windowtitle) choice_dialog.addButton(acceptbutton, QMessageBox.AcceptRole) return choice_dialog
def updateDialog(self): msgBox = QMessageBox() msgBox.setWindowTitle('Update available') msgBox.setText("There is a new version of AssetJet available.\n" \ "Do you want to download and install?") msgBox.setStandardButtons(QMessageBox.Yes | QtGui.QMessageBox.No) msgBox.setIcon(QMessageBox.Question) msgBox.setDefaultButton(QMessageBox.Yes) msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) reply = msgBox.exec_() return reply
def event_about(self): msgBox = QMessageBox() msgBox.setWindowTitle(APP_NAME) msgBox.setWindowIcon(QIcon(APP_ICON)) msgBox.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) msgBox.setText( ''' \n%s %s programmed by Snir Turgeman\nIf you found some bugs, please report to [email protected] \nEnjoy!\n ''' % (APP_NAME, APP_VERSION) ) msgBox.exec_()
def run(app): # Ask user for AssetJet database location dlgDbLocation = DbLocation() # Hide the 'What's This' question mark dlgDbLocation.setWindowFlags(QtCore.Qt.WindowTitleHint) if dlgDbLocation.exec_(): loc = os.path.join(dlgDbLocation.getText(),'assetjet.db') # create directory if it doesn't exist yet if not os.path.exists(dlgDbLocation.getText()): os.mkdir(dlgDbLocation.getText()) cfg.add_entry('Database', 'DbFileName', loc) # Start download thread if database is not existing yet if not os.path.exists(loc): # Check internet connection from assetjet.util import util if util.test_url('http://finance.yahoo.com'): # Start download thread download = download_data.Downloader(loc) download.daemon = True download.start() # Create download progress dialog dlgProgress = QtGui.QProgressDialog( labelText='Downloading 1 year of daily returns for members of the S&P 500. \n This may take a couple of minutes.\n' , minimum = 0, maximum = 500, flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) dlgProgress.setWindowTitle('Downloading...') dlgProgress.setCancelButton(None) dlgProgress.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) dlgProgress.show() # Update progress bar through signal download.downloaded.connect(dlgProgress.setValue) download.finished.connect(dlgProgress.close) app.exec_() # TODO: let it run in parallel with the local server thread download.wait() else: msgBox = QMessageBox() msgBox.setWindowTitle('No Internet Connection') msgBox.setText("To run AssetJet the first time, you need a working \n" \ "internet connection to download the historical returns.") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setIcon(QMessageBox.Warning) msgBox.setDefaultButton(QMessageBox.Ok) msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) reply = msgBox.exec_() sys.exit()
def check_db(self): try: self.cur.execute('''SELECT name FROM sqlite_master WHERE type='table' AND name="CLIPBOARD"''') table = self.cur.fetchall() if table.__len__() == 0: self.cur.execute('CREATE TABLE CLIPBOARD (ID INTEGER PRIMARY KEY ASC AUTOINCREMENT, DATE DATETIME, CONTENT VARCHAR)') self.cur.execute('CREATE TABLE PROPERTIES (NAME VARCHAR PRIMARY KEY, VALUE VARCHAR)') self.cur.execute('INSERT INTO PROPERTIES(NAME, VALUE) VALUES ("ALWAYS_ON_TOP", "Y")') self.cur.execute('INSERT INTO PROPERTIES(NAME, VALUE) VALUES ("BUFFER_SIZE", "200")') self.conn.commit() except lite.IntegrityError: print("Error occurd while trying to create CLIPBOARD table") msgBox = QMessageBox().about() msgBox.setWindowTitle(APP_NAME) msgBox.setWindowIcon(QIcon(APP_ICON)) msgBox.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) msgBox.setText("Error occurd while trying to create CLIPBOARD table, Please report to developer") msgBox.exec_()
def about(self): if self.about_window is None: window = QMessageBox(self) self.about_window = window else: window = self.about_window window = self.about_window window.setWindowIcon(QIcon(self.abouticon)) window.setWindowTitle('About ADLMIDI pyGUI') credits = "<center><b>ADLMIDI pyGUI v%s (%s)</b><br>Developed by Tristy H. \"KittyTristy\"<br>[<a href=\"https://github.com/KittyTristy/ADLMIDI-pyGUI\">Website</a>] [<a href=\"mailto:[email protected]\">Email</a>] <br><br><br>" % (__version__, system()) title = "<b>ADLMIDI pyGUI</b> is a GUI wrapper<br>written in Python for use with..<br><br><b>ADLMIDI: MIDI Player<br>for Linux and Windows with OPL3 emulation</b><br>" cw = "(C) -- <a href=\"http://iki.fi/bisqwit/source/adlmidi.html\">http://iki.fi/bisqwit/source/adlmidi.html</a></center>" credits = credits + title + cw window.setText(credits) window.show() window.activateWindow() window.raise_()
def process_clicked(self): dict_result = {} list_file_name = [] for index in xrange(self.ui.listWidget.count()): arquivo = self.ui.listWidget.item(index).text() list_file_name.append(arquivo) list_of_tuples_mass_and_windows = [] for index in xrange(self.ui.treeWidget.topLevelItemCount()): item = self.ui.treeWidget.topLevelItem(index) list_of_tuples_mass_and_windows.append( (float(item.text(0)), float(item.text(1)), float(item.text(2).split(",")[0]), str(item.text(2).split(",")[1]))) list_of_tuples_mass_and_windows_thresould = self.RemoveRepetidosLista( list_of_tuples_mass_and_windows) find_peaks = ImportThermoFile( list_of_tuples_mass_and_windows_thresould, list_file_name, dict_result) find_peaks.start() find_peaks.join() icon_reader = QIcon(":/icons/images/find.png") icon_readerII = QPixmap(":/icons/images/find.png") message = QMessageBox() if len(dict_result.keys()) > 0: try: MzMatches_To_Report(dict_result) message.setIconPixmap(icon_readerII) message.setText('Success') message.setWindowIcon(icon_reader) message.setWindowTitle("Success") message.exec_() except: message.setIconPixmap(icon_readerII) message.setText('Ups something went wrong') message.setWindowIcon(icon_reader) message.setWindowTitle("Success") message.exec_() else: message.setIconPixmap(icon_readerII) message.setText('Sorry no matches found') message.setWindowIcon(icon_reader) message.setWindowTitle("No matches") message.exec_()