def test(): from qt import QWidget class W(QWidget): def __init__(self): QWidget.__init__(self) def create(): global _list s = SampleControl() s.load('/home/ajole/wav/trance.wav') s.slotStart() s.slotSetZone(0, True) _list.append(s) import pkaudio from qt import QApplication, QPushButton, QObject, SIGNAL pkaudio.connect_to_host(startserver=0) a = QApplication([]) w1 = SampleControl() w1.load('/home/ajole/wav/track.wav') w1.slotStart() w1.slotSetZone(0, True) b = QPushButton('create', None) QObject.connect(b, SIGNAL('clicked()'), create) b.show() a.setMainWidget(b) a.exec_loop()
def showSplash(splashImageName): """ Function which shows a nice splash screen. @param splashImageName: Name of the splash screen image. @type splashImageName: C{unicode} """ screen = QApplication.desktop().screenGeometry() if not _haveImagesAsModule: addQtImagePath(constants.LOCAL_INSTALLED_ICONS_DIRECTORY_PATH) dfPicture = QPixmap.fromMimeSource(splashImageName) dfSplash = QLabel(None, "splash", Qt.WDestructiveClose | Qt.WStyle_Customize | Qt.WStyle_NoBorder |\ Qt.WX11BypassWM | Qt.WStyle_StaysOnTop) dfSplash.setFrameStyle(QFrame.WinPanel | QFrame.Raised) dfSplash.setPixmap(dfPicture) dfSplash.setCaption("DataFinder") dfSplash.setAutoResize(1) dfSplash.move(QPoint(screen.center().x() - dfSplash.width() / 2, screen.center().y() - dfSplash.height() / 2)) dfSplash.show() dfSplash.repaint(0) QApplication.flush() return dfSplash
def main(argv): filename = argv.pop() app = QApplication(argv) demo = Demo(filename) app.setMainWidget(demo) demo.show() app.exec_loop()
def qt_application(): app = QApplication(sys.argv) yield app.exec_() sys.exit()
def showSplash(splashImageName): """ Function which shows a nice splash screen. @param splashImageName: Name of the splash screen image. @type splashImageName: C{unicode} """ screen = QApplication.desktop().screenGeometry() if not _haveImagesAsModule: addQtImagePath(constants.LOCAL_INSTALLED_ICONS_DIRECTORY_PATH) dfPicture = QPixmap.fromMimeSource(splashImageName) dfSplash = QLabel(None, "splash", Qt.WDestructiveClose | Qt.WStyle_Customize | Qt.WStyle_NoBorder |\ Qt.WX11BypassWM | Qt.WStyle_StaysOnTop) dfSplash.setFrameStyle(QFrame.WinPanel | QFrame.Raised) dfSplash.setPixmap(dfPicture) dfSplash.setCaption("DataFinder") dfSplash.setAutoResize(1) dfSplash.move( QPoint(screen.center().x() - dfSplash.width() / 2, screen.center().y() - dfSplash.height() / 2)) dfSplash.show() dfSplash.repaint(0) QApplication.flush() return dfSplash
def main(): app = QApplication(sys.argv) window = gui.window.MainWindow() window.show() app.exec_() sys.exit()
def busy(b=True, cursor=None): """ if True, set a busy mouse cursor for the whole app, otherwise unset. """ if b: if cursor is None: cursor = QCursor(Qt.BusyCursor) QApplication.setOverrideCursor(cursor) else: QApplication.restoreOverrideCursor()
def __pegar_privado(self): """Pega lo que haya sido copiado""" clipboard = QApplication.clipboard() registro = clipboard.text().latin1() lista = eval(registro) posrow = self.grid.table1.currentRow() poscol = self.grid.table1.currentColumn() if len(lista[0]) == self.__idu.n_var(): poscol = 0 #Copia de registro completo else: #No permitimos pegar si el pegado implica variables nuevas assert(poscol + len(lista[0]) <= self.__idu.n_var()) self.__portero.guardar_estado() #Guardamos el estado #Creamos nuevos registros hasta la posicion del cursor if posrow > self.__idu.n_reg(): for _ in range(self.__idu.n_reg(), posrow): self.__idu.ana_reg() #Hacemos el pegado efectivo i = posrow for registro in lista: if i >= self.__idu.n_reg(): self.__idu.ana_reg() j = poscol for campo in registro: if campo != None: self.__idu[i][j] = campo j += 1 i += 1 self.grid.myUpdate()
def __init__(self, app=None): self.running = 0 posixbase.PosixReactorBase.__init__(self) if app is None: app = QApplication([]) self.qApp = app self.addSystemEventTrigger('after', 'shutdown', self.cleanup)
def __copiar_privado(self): """Esta funcion pega el contenido del clipboard en la tabla actual""" tablaactual = self.grid.currentPageIndex() assert(tablaactual == 0) #TODO Cambiar por una excepcion más concreta lista = self.grid.lista_seleccion() cadena = repr(lista) clipboard = QApplication.clipboard() clipboard.setData(QTextDrag(cadena))
def main(args): qapp=QApplication(sys.argv) kuraapp.initApp(str(guiConf.username), str(guiConf.database), str(guiConf.password), str(guiConf.hostname)) kuraapp.initCurrentEnvironment(1, 1, 1) mainwin = QDialog() combobox = QComboBox(mainwin) comboproxy = ComboProxy(combobox, kuraapp.app.getObjects("lng_user"), guiConf.usernr) mainwin.show() qapp.connect(qapp, SIGNAL('lastWindowClosed()'), qapp, SLOT('quit()')) qapp.exec_loop()
def __init__(self): try: from PyQt4 import QtGui self.app = QtGui.QApplication(sys.argv) self.mbox = QtGui.QMessageBox except ImportError: from qt import QApplication, QMessageBox self.app = QApplication(sys.argv) self.mbox = QMessageBox
def __init__(self, interfazconfig, portero, idu, idf, interfazproyectos, \ interfazoperaciones, gestorpaquetes, options, esnuevo): QApplication.__init__(self, []) self.__options = options self.__nuevo = esnuevo gestortemas = temas.GestorTemas() gestorsalida = gestores.GestorSalida() LOG.info('Cargado modulo de temas') self.__gestorconfig = interfazconfig self.__gestorproyectos = interfazproyectos self.__ioperaciones = interfazoperaciones self.vprincipal = VPrincipal(self, self.__gestorconfig, portero, \ idu, self.__gestorproyectos, gestortemas, interfazoperaciones) self.vsalida = VSalida(self, gestorsalida, gestortemas) self.dcrevar = DCrevar(self.vprincipal, idu, interfazconfig, gestorpaquetes) LOG.info('Cargado dialogo de creación de variables') self.__dsplash = DSplash(self.vprincipal, gestortemas, self.__gestorconfig, self.vsalida) self.doperaciones = DOperaciones(self.vprincipal, idu, interfazoperaciones, self.vsalida) self.dimportartexto = DImportarTexto(self.vprincipal, idf) self.vprincipal.conexiones()
def main(): """ Start function. """ application = QApplication(sys.argv) splashScreen = utils.showSplash("splash_datafinder_admin.png") splashScreen.show() repositoryManager = RepositoryManager() repositoryManager.load() adminMainWindow = AdminMain(repositoryManager) application.connect(application, SIGNAL("lastWindowClosed()"), application, SLOT("quit()")) application.setMainWidget(adminMainWindow) screen = QApplication.desktop().screenGeometry() adminMainWindow.move( QPoint(screen.center().x() - adminMainWindow.width() / 2, screen.center().y() - adminMainWindow.height() / 2)) adminMainWindow.show() splashScreen.close(True) adminMainWindow.fileConnectSlot() application.exec_loop()
def main(): """ Start function. """ application = QApplication(sys.argv) splashScreen = utils.showSplash("splash_datafinder_admin.png") splashScreen.show() repositoryManager = RepositoryManager() repositoryManager.load() adminMainWindow = AdminMain(repositoryManager) application.connect(application, SIGNAL("lastWindowClosed()"), application, SLOT("quit()")) application.setMainWidget(adminMainWindow) screen = QApplication.desktop().screenGeometry() adminMainWindow.move(QPoint(screen.center().x() - adminMainWindow.width() / 2, screen.center().y() - adminMainWindow.height() / 2)) adminMainWindow.show() splashScreen.close(True) adminMainWindow.fileConnectSlot() application.exec_loop()
def main(args): qapp=QApplication(args) kuraapp.initApp(str(guiConf.username), str(guiConf.database), str(guiConf.password), str(guiConf.hostname)) kuraapp.initCurrentEnvironment(1, 1, 1) app = kuraapp.app mainwin=GuiTable(None, None, None) mainwin.show() mainwin.refresh(app.createObject('lng_lex', fields={})) qapp.connect(qapp, SIGNAL('lastWindowClosed()'), qapp, SLOT('quit()')) qapp.setFont(QFont(guiConf.textfontfamily, guiConf.textfontsize), True) qapp.exec_loop()
def test_monitor_silence(self): app = QApplication([]) session = self.session session.SILENCE_TIMEOUT = 1 # 1 millisecond instead of 10000 to be quicker self.failUnlessEqual(session.monitor_silence, False) self.failUnlessEqual(session.monitor_timer.isActive(), False) session.monitor_silence = True self.failUnlessEqual(session.monitor_timer.isActive(), True) time.sleep(2e-3) # 2 * SILENCE_TIMEOUT (in seconds) app.processEvents() self.failUnless(('notifySessionState', (emulation.NOTIFYSILENCE, )) in session._logs) session.monitor_silence = False self.failUnlessEqual(session.monitor_timer.isActive(), False) app.quit()
def main(argv): app = QApplication(argv) qtTr = QTranslator() if qtTr.load("qt_" + QLocale.system().name(), ":/i18n/"): app.installTranslator(qtTr) appTr = QTranslator() if appTr.load("hestia_" + QLocale.system().name(), ":/i18n/"): app.installTranslator(appTr) win = MainWindow() win.show() return app.exec_()
# girdiyi gönder. ret = self.server.addEntry(username, password, str(self.filename), str(text.utf8()), self.inEdit) if not ret: QMessageBox.critical(self, "HATA", u"Girdi yayınlanamadı!") else: QMessageBox.information(self, "Bitti", u"Girdi başarı ile yayınlandı!") self._fillEntryList() # yayınladıktan sonra eğer içindeysek, EditMode'dan # çıkalım. Ve metin girişini temizleyelim. if self.inEdit: self.setEditMode(False) self.w.entryText.clear() def slotQuit(self): self.close() if __name__ == "__main__": app = QApplication(sys.argv) app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) win = BlogWin() win.show() app.exec_loop()
class ListNotebook(QSplitter): def __init__(self, parent=None): QSplitter.__init__(self, parent, 'hsplit') self.setOrientation(QSplitter.Horizontal) self.listbox = QListView(self) #self.insertWidget(self.listbox) self.notebook = QTabBar(self) #self.addWidget(self.notebook) cfg = PaellaConfig('database') conn = PaellaConnection() cursor = StatementCursor(conn) app = QApplication(sys.argv) #lv = QListView(None) #lv.addColumn('section') #for s in cursor.tables(): # lv.insertItem(QListViewItem(lv, s)) #lv.show() hello = QLabel('<font color=blue>%s <i>Qt!</i></font>' % str(cfg.section), None) #lb = Listbox(None, cursor.select(table='gunny_templates')) ln = ListNotebook() ln.show() ln.listbox.addColumn('table') for t in cursor.tables(): ln.listbox.insertItem(QListViewItem(ln.listbox, t)) app.setMainWidget(ln)
self.resetButtons() return def stopCommand(self): self.resetButtons() self.process.tryTerminate() QTimer.singleShot(5000, self.process, SLOT("kill()")) def readOutput(self): self.textBrowser.append(QString(self.process.readStdout())) def readErrors(self): self.textBrowser.append("error: " + QString(self.process.readLineStderr())) def resetButtons(self): self.startButton.setEnabled(True) self.stopButton.setEnabled(False) if __name__ == "__main__": app = QApplication(sys.argv) window = Window() app.setMainWidget(window) window.show() sys.exit(app.exec_loop())
"""iqt Provides control over PyQt and PyQwt widgets from the command line interpreter. """ # Import GNU readline, so that readline can do its work in Python scripts. # _iqt falls back on a different method when there is no GNU readline. try: import readline except ImportError: pass from qt import QApplication, qApp # Provoke a runtime error when no QApplication instance exists, since # qApp does not return None when no QApplication instance exists. try: qApp.name() except RuntimeError: _a = QApplication([]) import _iqt # Local Variables: *** # mode: python *** # End: ***
def __prepare(self, hostUri, configurationPath, dataPath, username, password): """ Performs basic checks in thread. """ try: self.__model.prepareConfiguration(hostUri, configurationPath, dataPath, username, password) except ConfigurationError, error: self.__errorMessage = error.message def __performConfigurationCreation(self, overwrite): """ Performs the configuration creation and handles errors. """ try: self.__model.createConfiguration(overwrite) except ConfigurationError, error: self.__errorMessage = error.message def __getView(self): """ Returns the generated view class. """ return self.__view.view view = property(__getView) # simple self-test if __name__ == "__main__": application = QApplication(sys.argv) controller = CreateConfigurationController() application.setMainWidget(controller.view) application.exec_loop()
def __init__(self, argv, opts): QApplication.__init__(self, argv)
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' from utils import erroGtk try: from qt import QApplication except: mensagem_erro = u'''Um erro de importação ocorreu, é provável que você não tenha o Qt ou o PyQt instalado. Para instalar, execute o seguinte comando: sudo apt-get install qt3-dev-tools pyqt-tools python-qt3''' erroGtk(mensagem_erro) try: import sqlite except: mensagem_erro = u'''Um erro de importação ocorreu, é provável que você não tenha o sqlite instalado. Para instalar, execute o seguinte comando: sudo apt-get install sqlite''' erroGtk(mensagem_erro) import sys from JanelaPrincipal import JanelaPrincipal if __name__ == "__main__": app = QApplication(sys.argv) a = JanelaPrincipal() a.show() app.exec_loop()
self.mutex = NSRecursiveLock.alloc().init() def lock(self): self.mutex.lock() def unlock(self): self.mutex.unlock() import thread class Foo(BaseQObject): def doMainFoo(self): print 'doMainFoo(): thread id = ' % thread.get_ident() def doFoo(self): print 'doFoo(): thread id = ' % thread.get_ident() self.postEventWithCallback(self.doMainFoo) if __name__ == "__main__": foofoo = Foo() import threading threading.Timer(1.0, foofoo.doFoo) from qt import QApplication app = QApplication([]) app.exec_loop()
self.repositoryConfiguration.delete() except ConfigurationError, error: errorMessage = "Unable to delete configuration.\n Reason: '%s'" % error.message self.__showErrorMessage(errorMessage) else: self.repositoryConfiguration.release() self.__setConnectionState(False) def fileExitSlot(self): """ Exits the administration client. """ try: self._repositoryManager.savePreferences() except ConfigurationError, error: self.__logger.error(error.message) QApplication.exit(0) def showAboutDialogSlot(self): """ Shows the about dialog. """ self.dfAboutDialog.exec_loop() def uploadIconSlot(self): """ Upload icon(s) to WebDAV-server Images collection. """ filePaths = list( QFileDialog.getOpenFileNames("Image Files (*16.png)", self._lastUploadDirectory, self, "open file dialog", "Choose files"))
self.repositoryConfiguration.delete() except ConfigurationError, error: errorMessage = "Unable to delete configuration.\n Reason: '%s'" % error.message self.__showErrorMessage(errorMessage) else: self.repositoryConfiguration.release() self.__setConnectionState(False) def fileExitSlot(self): """ Exits the administration client. """ try: self._repositoryManager.savePreferences() except ConfigurationError, error: self.__logger.error(error.message) QApplication.exit(0) def showAboutDialogSlot(self): """ Shows the about dialog. """ self.dfAboutDialog.exec_loop() def uploadIconSlot(self): """ Upload icon(s) to WebDAV-server Images collection. """ filePaths = list(QFileDialog.getOpenFileNames("Image Files (*16.png)", self._lastUploadDirectory, self, "open file dialog",
######################### import undo undo._use_hcmi_hack = False ######################### import MWsemantics import startup_funcs STILL_NEED_MODULARIZATION = True if STILL_NEED_MODULARIZATION: # file functions don't work right unless I do all this first startup_funcs.before_creating_app() app = QApplication([ ]) foo = MWsemantics.MWsemantics() startup_funcs.pre_main_show(foo) foo.show() startup_funcs.post_main_show(foo) else: foo = fileSlotsMixin() # ? ? ? # we still want assembly and group and atom, # and we still want to be able to select subgroups # but we don't want QApplication and QMainWindow ################### class FileTest(unittest.TestCase):
import sys from qt import QLabel, QApplication from qtsql import QSqlDatabase, QSqlCursor from qtsql import QDataTable, QSqlQuery from paella.base import Error from paella.sqlgen.statement import Statement from paella.profile.base import PaellaConfig dbdriver = 'QPSQL7' cfg = PaellaConfig('database') app = QApplication(sys.argv) db = QSqlDatabase.addDatabase(dbdriver) if db: db.setHostName(cfg['dbhost']) db.setDatabaseName(cfg['dbname']) db.setUserName(cfg['dbusername']) db.open() else: raise Error, 'bad db' s = Statement() cursor = QSqlCursor(None, True, QSqlDatabase.database(dbdriver, True)) #s.table = 'suites' s.table = 'gunny_templates' #query = QSqlQuery(q) #cursor = query print cursor.execQuery(str(s))
def __textMargin(): """text margin""" return QApplication.style().pixelMetric( QStyle.PM_FocusFrameHMargin) + 1
""" Performs basic checks in thread. """ try: self.__model.prepareConfiguration(hostUri, configurationPath, dataPath, username, password) except ConfigurationError, error: self.__errorMessage = error.message def __performConfigurationCreation(self, overwrite): """ Performs the configuration creation and handles errors. """ try: self.__model.createConfiguration(overwrite) except ConfigurationError, error: self.__errorMessage = error.message def __getView(self): """ Returns the generated view class. """ return self.__view.view view = property(__getView) # simple self-test if __name__ == "__main__": application = QApplication(sys.argv) controller = CreateConfigurationController() application.setMainWidget(controller.view) application.exec_loop()
logger.debug( "trying to add incompatible types for a label in data panel") update_data_label(self.yb_data, self.all_data.yb) update_data_label(data_label=self.w_lambda_data, data_info=self.all_data.w_lambda, n_dec=6) # update_data_label(self.w_lambda_data, self.all_data.w_lambda) update_data_label(self.d_dist_data, self.all_data.dd) update_data_label(self.strn_sp_data, self.all_data.n_strng) update_data_label(self.indx_sp_data, self.all_data.n_index) update_data_label(self.refn_sp_data, self.all_data.n_refnd) update_data_label(self.itgr_sum_data, self.all_data.n_integ_sum) update_data_label(self.itgr_prf_data, self.all_data.n_integ_prf) update_data_label(self.spgrp_data, self.all_data.spg_group) if __name__ == "__main__": logger.debug("\n sys.argv(s) = %s %s %s", sys.argv[1], sys.argv[2], "\n") app = QApplication(sys.argv) ex = InfoWidget() ex.show() ex.update_data(sys.argv[1], [sys.argv[2]]) sys.exit(app.exec_())
def main(args): app = QApplication(args) demo = make() app.setMainWidget(demo) app.exec_loop()