def yes(self): """Confirm the deletion of a contact.""" name = self.name gui.mainWindow(self.master).delete_contact(name) db.db_commit() self.top.destroy()
def field_return(self): """Grabs form data and creates""" field_list = [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '] first = self.first_name.get() last = self.last_name.get() st1 = self.address1.get() st2 = self.address2.get() city = self.city.get() state = self.state.get() zip = self.zip.get() home = self.home.get() mobile = self.mobile.get() email = self.email.get() bday = self.birthday.get() notes = self.notes.get() field_vars = [first, last, st1, st2, city, state, zip, home, mobile, email, bday, notes] for i in range(12): field_list[i] = field_vars[i] ab.add_contact(field_list) gui.mainWindow(self.master).search_query(gui.mainWindow(self.master).sort.get()) # self.contact_list() self.close_window()
def ok(self): book_name = self.book_name.get() db.db_init(book_name) ## <----- PASS USER INPUT book_name root = Tk.Tk() self.master.withdraw() root.protocol("WM_DELETE_WINDOW", exit) gui.mainWindow(root) root.mainloop() sys.exit()
def ok(self): """Open the user specified address book.""" book_name = self.book_name.get() if len(book_name) > 1: db.db_init(book_name) root = Tk.Tk() self.master.withdraw() root.protocol("WM_DELETE_WINDOW", exit) gui.mainWindow(root) root.mainloop() sys.exit() else: self.c = newcw.ConfirmationWindow(self.master)
def ok(self): """Open the user specified address book.""" book_name = self.book_name.get() if len(book_name) > 1: db.db_init(book_name) root = Tk.Tk() self.master.withdraw() root.protocol("WM_DELETE_WINDOW", exit) gui.mainWindow(root) root.mainloop() sys.exit() else: self.c=newcw.ConfirmationWindow(self.master)
def spawn(cfg): 'Spawn the Application' pxcfg = here + 'z-data_/launch.yaml' spawnCFG = config.instruct(pxcfg).load() #override(cfg) app = QApplication(sys.argv) # ||Start the App Container aw = gui.mainWindow() # || aw.show() sys.exit(app.exec_())
def field_return(self): """Grabs contact form data and sends it to add_contact() in AddressBook.py. """ # List to hold form data field_list = [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ] # Get form data first = self.first_name.get() last = self.last_name.get() st1 = self.address1.get() st2 = self.address2.get() city = self.city.get() state = self.state.get() zip = self.zip.get() home = self.home.get() mobile = self.mobile.get() email = self.email.get() bday = self.birthday.get() notes = self.notes.get() field_vars = [ first, last, st1, st2, city, state, zip, home, mobile, email, bday, notes ] # Add form data to field_list for i in range(12): field_list[i] = field_vars[i] # If contact entry has a first name, add the entry. # Else, warn user there is no first name. if field_list[0] != '': ab.add_contact(field_list) else: self.c = cw.ConfirmationWindow(self.master) gui.mainWindow(self.master).search_query( gui.mainWindow(self.master).sort.get()) self.close_window()
def field_return(self): """Grabs contact form data and returns it to popup_confirmation()""" # List to hold form data field_list = ['','','','','','','','','','','',''] # Get form data first = self.first_name.get() last = self.last_name.get() st1 = self.address1.get() st2 = self.address2.get() city = self.city.get() state = self.state.get() zip = self.zip.get() home = self.home.get() mobile = self.mobile.get() email = self.email.get() bday = self.birthday.get() notes = self.notes.get() field_vars = [first, last, st1, st2, city, state, zip, home, mobile, email, bday, notes] # Add form data to field_list for i in range(12): field_list[i] = field_vars[i] # If contact entry has a first name, ask user to confirm edit. # Else, warn user there is no first name. if field_list[0] != '': self.popup_confirmation(field_list, self.entry_id) else: self.c=addcw.ConfirmationWindow(self.master) gui.mainWindow(self.master).search_query(gui.mainWindow( self.master).sort.get()) self.close_window()
def yes(self): name = self.name gui.mainWindow(self.master).delete_contact(name) db.db_commit() self.top.destroy()
class EventGen(threading.Thread): def __init__(self, target): threading.Thread.__init__(self) self.target = target def run(self): #let gui start import time time.sleep(0.2) #force focus to widget self.target.focus_force() #generate mouse 1 self.target.event_generate("<ButtonPress>") self.target.event_generate("<ButtonRelease") self.target.update() if __name__ == "__main__": ab.new_book() root = Tk.Tk() gui.mainWindow(root) egen = EventGen(root) egen.start() root.mainloop()
def __init__(self): parent = gui.mainWindow() # stay on top added for maya2014 osx super(Gui, self).__init__(parent, QtCore.Qt.WindowStaysOnTopHint) self.toolActive = False #self.setWindowFlags( self.windowFlags() ) #self.setWindowFlags(QtCore.Qt.Window) self.setWindowTitle('Markerset Tool') self.resize( 500, 600 ) self.markers = None self.markerset = None self.prefix = None self.customSets = {} self.mainlayout = QtWidgets.QVBoxLayout() self.hlayout = QtWidgets.QHBoxLayout() self.menuBar = QtWidgets.QMenuBar() self.toolbar = QtWidgets.QToolBar() self.setStyleSheet( "QToolButton { background-color: #222; padding: 3px; margin: 3px; border: 1px solid gray; } "); self.mainlayout.setMenuBar(self.menuBar) # markerset combo self.formLayout = QtWidgets.QFormLayout() self.markersetSelector = QtWidgets.QComboBox(self) self.markersetSelector.currentIndexChanged.connect( self.markersetSelect ) self.formLayout.addRow( "Markerset", self.markersetSelector ) # markerset prefix table self.prefixSelector = QtWidgets.QTableWidget(self) self.prefixSelector.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection); self.prefixSelector.itemChanged.connect( self.prefixItemChange ) self.prefixSelector.currentCellChanged.connect( self.prefixSelected ) self.prefixSelector.setColumnCount(2) self.prefixSelector.setColumnWidth(0, 200) self.prefixSelector.setColumnWidth(1, 30) self.prefixSelector.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.formLayout.addRow( self.prefixSelector ) # display mode combo self.displaySelector = QtWidgets.QComboBox(self) self.displaySelector.currentIndexChanged.connect( self.setDisplayMode ) self.displaySelector.addItems( [ '--select--', 'square', 'circle', 'cross', 'circle/cross' ] ) self.formLayout.addRow( "Display Markers", self.displaySelector ) # display mode-selected self.displaySelector2 = QtWidgets.QComboBox(self) self.displaySelector2.currentIndexChanged.connect( self.setSelectedMode ) self.displaySelector2.addItems( [ '--select--', 'square', 'circle', 'cross', 'circle/cross' ] ) self.formLayout.addRow( "Display Selected", self.displaySelector2 ) # source range mode self.sourceRangeSelector = QtWidgets.QComboBox(self) self.sourceRangeSelector.addItems( [ 'gap', 'fill', 'segment', 'spike', 'all', 'selected' ] ) self.formLayout.addRow( "Source Range", self.sourceRangeSelector ) # replace mode self.replaceModeSelector = QtWidgets.QComboBox(self) self.replaceModeSelector.addItems( [ 'extract', 'swap', 'overwrite' ] ) self.formLayout.addRow( "Replace Mode", self.replaceModeSelector ) # buttons buttonLayout = QtWidgets.QHBoxLayout() refreshButton = QtWidgets.QToolButton(self) refreshButton.setText("Refresh") refreshButton.clicked.connect( self.markersetSelect ) oneTwoButton = QtWidgets.QToolButton(self) oneTwoButton.setText("1->2") oneTwoButton.clicked.connect( self.onetwo ) queryButton = QtWidgets.QToolButton(self) queryButton.setText("?") queryButton.clicked.connect( self.query ) queryButton.setToolTip("select affected keys") highlightButton = QtWidgets.QToolButton(self) highlightButton.setText("^") highlightButton.clicked.connect( self.highlight ) highlightButton.setToolTip("Highlight selected") toolButton = QtWidgets.QToolButton(self) toolButton.setText("*") toolButton.clicked.connect( self.tool ) toolButton.setToolTip("Assignment Tool") buttonLayout.addWidget(refreshButton) buttonLayout.addWidget(oneTwoButton) buttonLayout.addWidget(queryButton) buttonLayout.addWidget(highlightButton) buttonLayout.addWidget(toolButton) #buttonWidget = QtWidgets.QWidget() #buttonWidget.setLayout(buttonLayout) self.formLayout.addRow( buttonLayout ) # colors self.colorWidget = QtWidgets.QWidget(self) self.colorLayout = QtWidgets.QHBoxLayout(self.colorWidget) for c in [14, 15, 22, 27, 28, 29, 30, 31 ] : self.colorLayout.addWidget ( colorButton( c , partial( self.cb_color, c ) ) ) self.colorWidget.setLayout(self.colorLayout) self.formLayout.addRow( self.colorWidget ) # progress self.progressBar = QtWidgets.QProgressBar(self) self.progressBar.setVisible(False) self.formLayout.addRow(self.progressBar) self.progressLabel = QtWidgets.QLabel(self) self.progressLabel.setVisible(False) self.formLayout.addWidget(self.progressLabel) self.progressLabel.setSizePolicy( QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) ) # marker select list self.markerList = QtWidgets.QTableWidget(1, 4, self) self.markerList.itemClicked.connect( self.cb_select ) self.markerList.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection ) # marker assign list #self.assignList = QtWidgets.QListWidget(self) #self.assignList.itemClicked.connect( self.cb_change ) # markerset menu markersetMenu = QtWidgets.QMenu("Markerset", parent=self) self.menuBar.addMenu(markersetMenu) for text, func in [ ( 'Load', self.cb_load), ( 'Save', self.cb_save), ( 'From Selection', self.cb_fromSelection), ( 'Set Markerset Directory', self.cb_setMarkersetDir), ( 'Refesh', self.loadMarkersets ), ( 'Save Markerset', self.cb_save ) ] : action = QtWidgets.QAction( text, self ) action.triggered.connect(func) markersetMenu.addAction( action) # marker menu markerMenu = QtWidgets.QMenu("Markers", parent=self) self.menuBar.addMenu(markerMenu) for text, func in [ ( 'Draw Line', self.cb_drawLine ), ( 'Clear Lines', self.cb_clearMarkerLines), ( 'Select Empty', self.cb_selectEmpty), ( 'Select Unlabelled', self.cb_selectUnlabelled) , ( 'Set Data Rate', self.cb_setDataRate), ] : action = QtWidgets.QAction( text, self ) action.triggered.connect(func) markerMenu.addAction( action) # toolbar for text, func in [ ( 'sel', self.cb_selectMarkers ) , ( 'sel-all', self.cb_selectAll ), ( 'lines', self.cb_drawLines ), ( 'active', self.cb_setActive), ( 'display', self.cb_display), ] : action = QtWidgets.QAction( text, self ) action.triggered.connect(func) self.toolbar.addAction( action ) # layout self.hlayout.addWidget( self.markerList, 1 ) self.hlayout.addLayout( self.formLayout, 0 ) self.mainlayout.addWidget( self.toolbar, 0 ) self.mainlayout.addLayout( self.hlayout, 1 ) #self.mainWidget = QtGui.QWidget() #self.mainWidget.setLayout( self.mainlayout ) #self.setCentralWidget(self.mainWidget) self.setLayout( self.mainlayout ) #self.setWindowFlags( self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint ) #self.setWindowFlags( self.windowFlags() & ~QtCore.Qt.WindowStaysOnBottomHint ) self.loadMarkersets() # guess the markerset by finding the set with the most matching markers results = [] for i, setName in enumerate( markerset.markersets.keys() ) : mset = markerset.markersets[ setName ] for prefix in mset.prefixes() : found, missing = mset.test(prefix ) results.append ( ( i, prefix, len(found) ) ) if len(results) > 0 : maxval = max( results, key = lambda v : v[2] )[0] self.markersetSelector.setCurrentIndex(maxval+1) self.markersetSelect() startCommand = "import " + localsettings.module + ".labeler as l;l.startTool()" finishCommand = "import " + localsettings.module + ".labeler as l;l.selectEvent()" self.context = m.scriptCtx( t='test', ts='python("' + startCommand + '")', tf='python("' + finishCommand + '")', tct='dot', lc=True, tss=1)
def no(self): gui.mainWindow(self.master).contact_list() self.top.destroy()
def no(self): """Decline the deletion of a contact.""" gui.mainWindow(self.master).search_query( gui.mainWindow(self.master).sort.get()) self.top.destroy()
def __init__(self, parser = None) : # wrap to maya super(Loader, self).__init__(parent=gui.mainWindow()) self.setWindowTitle("Mocap Loader") self.parser = parser if self.parser is None : # get the current basedir (set by the menu option) if m.optionVar(exists='peelLoaderDirectory') : basedir = m.optionVar(q='peelLoaderDirectory') self.parser = mocapData.LocalParser(basedir) else : self.parser = None #self.parser = mocapData.WebParser() if self.parser : self.parser.message.connect( self.getMessage ) self.parser.error.connect( self.getError ) self.parser.progress.connect( self.getProgress ) markerset.loadAll() if len(markerset.markersets) == 0 : m.warning("No markersets loaded.") ''' Create an index, populating data @param dir local directory to use, if none will read from the web ''' self.cache = fileCache.FileCache() self.pathPrefix = "/2" # dont move this next line to further down - it needs to be here for some reason mainLayout = QtWidgets.QVBoxLayout(self) ########## # topBar # session combo self.selector = QtWidgets.QComboBox(self) self.selector.currentIndexChanged.connect( self.updateLists ) # fps combo self.fpsSelector = QtWidgets.QComboBox(self) for i in [ '24', '30', '60' ] : self.fpsSelector.addItem( i ) # reload button self.reloadButton = QtWidgets.QPushButton("Reload", self) self.reloadButton.clicked.connect(self.cb_reload) # rename as cleaning checkbox self.cleaningCB = QtWidgets.QCheckBox("Cleaning", self) self.topbarLayout = QtWidgets.QHBoxLayout(self) self.topbarLayout.addWidget(self.selector , 1) self.topbarLayout.addWidget(self.fpsSelector, 0) self.topbarLayout.addWidget(self.reloadButton, 0) self.topbarLayout.addWidget(self.cleaningCB, 0) self.topbarLayout.addSpacerItem(QtWidgets.QSpacerItem(0,0)) # task combo self.taskSelector = QtWidgets.QComboBox(self) for i in [ 'raw', 'cleaning', 'solving' ] : self.taskSelector.addItem( i ) self.taskSelector.currentIndexChanged.connect( self.taskChange ) # buttons self.loadButton = QtWidgets.QPushButton("Load", self) self.loadButton.clicked.connect(self.loadFile) self.buildCleaningButton = QtWidgets.QPushButton("Build Cleaning", self) self.buildCleaningButton.clicked.connect(self.buildClean) self.loadTemplateButton = QtWidgets.QPushButton("Import Latest Template(s)", self) self.loadTemplateButton.clicked.connect(self.loadSolveTemplate) self.buildSolvingButton = QtWidgets.QPushButton("Build Solving", self) self.buildSolvingButton.clicked.connect(self.buildSolve) self.browseButton = QtWidgets.QPushButton("Browse", self) self.browseButton.clicked.connect( self.browse ) # midbar self.midbarLayout = QtWidgets.QHBoxLayout(self) self.midbarLayout.addWidget(self.taskSelector, 0) self.midbarLayout.addWidget(self.loadButton, 0) self.midbarLayout.addWidget(self.buildCleaningButton, 0) self.midbarLayout.addWidget(self.buildSolvingButton, 0) self.midbarLayout.addWidget(self.loadTemplateButton, 0) self.midbarLayout.addWidget(self.browseButton, 0) self.midbarLayout.insertStretch(-1, 1) # Main Columns self.hsplitter = QtWidgets.QSplitter(self) # parent title click command dbl click command self.mocapTable = self.makeTable( self.hsplitter, "Mocap", self.previewMocap, self.loadMocap ) self.characterList = self.makeCol( self.hsplitter, "Character", self.previewCharacter, self.loadCharacter ) #self.referenceList = self.makeCol( self.hsplitter, "Reference", self.previewReference, self.loadReference ) self.mocapTable.setHorizontalHeaderLabels( [ "Take", "C", "S", "Frms", "In", "Out", "Subjects", "Notes" ] ); self.mocapTable.cellChanged.connect( self.cellChange ) # thumbnail image #self.imageWidget = QtWidgets.QLabel(self) #self.hsplitter.addWidget(self.imageWidget) self.hsplitter.setSizes( [ 600, 200 ] ) # Lower secion - buttons and Log Window self.log = QtWidgets.QTextEdit(self) self.log.setReadOnly(True) self.errorLog = QtWidgets.QTextEdit(self) self.errorLog.setReadOnly(True) logLayout = QtWidgets.QHBoxLayout(self) logLayout.addWidget( self.log ) logLayout.addWidget( self.errorLog ) self.lowerWidget = QtWidgets.QWidget(self) self.lowerLayout = QtWidgets.QVBoxLayout(self) self.lowerLayout.addLayout( self.midbarLayout) self.lowerLayout.addLayout( logLayout ) self.lowerWidget.setLayout(self.lowerLayout) # Options Menu menuBar = QtWidgets.QMenuBar() menu = menuBar.addMenu('Options') recentMenu = QtWidgets.QMenu("Recent") menuItems = [ ( "Set Directory", self.setDir ), ( None, None ), ( "Set Rig Directory", self.setRig ), ( "Re-scan" , self.loadData ), ( "Web Data", self.webData ), ( "Set Root Scale ", self.setRootScale ) ] for title, func in menuItems : if title is None : op = "peelMocapLoaderRecent" if m.optionVar( ex=op ) : menu.addMenu(recentMenu) val = m.optionVar( q=op ) if not isinstance(val, list) : val = [val] for i in val : subAction = QtWidgets.QAction( i, self ) subAction.triggered.connect( partial( self.setDir, i ) ) recentMenu.addAction( subAction ) else : action = QtWidgets.QAction( title, self ) action.triggered.connect( func ) menu.addAction( action ) # Rig Menu self.rigMenu = menuBar.addMenu('Rigs') # main layout # put the main columns and log in a splitter self.vsplitter = QtWidgets.QSplitter(self) self.vsplitter.setOrientation( QtCore.Qt.Vertical) self.vsplitter.addWidget( self.hsplitter ) self.vsplitter.addWidget( self.lowerWidget ) self.vsplitter.setSizes( [ 400, 100 ]) # draw the main layout mainLayout.addLayout( self.topbarLayout, 0 ) mainLayout.addWidget( self.vsplitter, 1 ) mainLayout.addWidget(menuBar) mainLayout.setMenuBar(menuBar) self.setLayout( mainLayout ) self.resize( 1000, 500 ) # Populate self.taskChange() self.loadData() self.populateRigMenu()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui = mainWindow() self.ui.setupUi(self) QtCore.QObject.connect(self.ui.loadUrlButton, QtCore.SIGNAL("clicked()"), self.display_page)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # main.py # # Copyright (C) 2010 Catullus Cassius # # This file is part of python-vkontakte-player. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 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/>. import PyQt4, sys import gui app = PyQt4.QtGui.QApplication(sys.argv) app.setApplicationName("Python vkontakte player") mw = gui.mainWindow() mw.show() app.exec_()
def no(self): gui.mainWindow(self.master).search_query() ## FIXME self.top.destroy()
import PyQt4 import sys import gui if __name__ == "__main__": app = PyQt4.QtGui.QApplication(sys.argv) chat = gui.mainWindow() chat.show() app.exec_()
self.target = target def run(self): #let gui start import time time.sleep(0.2) #force focus to widget self.target.focus_force(); #generate mouse 1 self.target.event_generate("<ButtonPress>") self.target.event_generate("<ButtonRelease") self.target.update() if __name__ == "__main__": ab.new_book() root = Tk.Tk() gui.mainWindow(root) egen = EventGen(root) egen.start() root.mainloop()
import PyQt4 import sys import gui if __name__ == "__main__": app = PyQt4.QtGui.QApplication(sys.argv) mw = gui.mainWindow() mw.show() app.exec_()
guiQueue = queue.Queue() # queue of message to the gui eventLock = threading.Lock() #create and launch the simulation manager thread commandQueue = queue.Queue(30) guiInput = UserInputManager.guiInput(commandQueue, eventCommand, eventSMQueue, eventLock, guiQueue) simulationManagerThread = SimulationManager.SMthread( commandQueue, eventCommand, eventSMQueue, eventLock) simulationManagerThread.setGuiQueue(guiQueue) simulationManagerThread.start() threads.append(simulationManagerThread) pr.enable() myMainWindow = gui.mainWindow(guiInput) myMainWindow.start() pr.disable() pr.dump_stats('/home/yang/Desktop/stats.txt') # s = io.StringIO() # sortby = 'cumulative' # ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # ps.print_stats() # print(s.getvalue()) #wait all threads to end for t in threads: t.join() print('Simulator Shutting Down')
def no(self): """Decline the deletion of a contact.""" gui.mainWindow(self.master).search_query(gui.mainWindow( self.master).sort.get()) self.top.destroy()
self.target.sort_option_menu.event_generate("<Button-1>",x=10, y=10) self.target.sort_option_menu.update() self.target.sort_option_menu.event_generate("<ButtonRelease-1>", x=10, y=10) self.target.sort_option_menu.update() print("sort succeeded") except: print("sort failed") self.target.quit() if __name__ == "__main__": ab.new_book() root = Tk.Tk() gui = gui.mainWindow(root) egen = EventGen(gui) egen.start() root.mainloop()
eventCommand = threading.Event() eventSMQueue = threading.Event() guiQueue = queue.Queue() # queue of message to the gui eventLock = threading.Lock() #create and launch the simulation manager thread commandQueue = queue.Queue(30) guiInput = UserInputManager.guiInput(commandQueue, eventCommand, eventSMQueue, eventLock, guiQueue) simulationManagerThread = SimulationManager.SMthread(commandQueue, eventCommand, eventSMQueue, eventLock) simulationManagerThread.setGuiQueue(guiQueue) simulationManagerThread.start() threads.append(simulationManagerThread) pr.enable() myMainWindow = gui.mainWindow(guiInput) myMainWindow.start() pr.disable() pr.dump_stats('/home/simon/Desktop/stats.txt') # s = io.StringIO() # sortby = 'cumulative' # ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # ps.print_stats() # print(s.getvalue()) #wait all threads to end for t in threads: t.join() print('Simulator Shutting Down')