def config(self): clientRepo = None movieRepo = None rentalRepo = None if self.__settings['repository'] == "text-file": clientRepo = FileRepository(self.__settings["clients"], "Client repo", Client.clientToFile, Client.clientFromFile) movieRepo = FileRepository(self.__settings["movies"], "Movie Repo", Movie.movieToFile, Movie.movieFromFile) rentalRepo = FileRepository(self.__settings["rentals"], "Rental repo", Rental.rentalToFile, Rental.rentalFromFile) if self.__settings['repository'] == "in-memory": clientRepo = InMemoryRepository() movieRepo = InMemoryRepository() rentalRepo = InMemoryRepository() if self.__settings['repository'] == "binary": clientRepo = PickleRepo(self.__settings["clients"], "Client repo") movieRepo = PickleRepo(self.__settings["movies"], "Movie Repo") rentalRepo = PickleRepo(self.__settings["rentals"], "Rental repo") if self.__settings['repository'] == 'json': clientRepo = JsonRepo(self.__settings["clients"], "ClientRepo", Client.clientFromJson) movieRepo = JsonRepo(self.__settings["movies"], "Movie Repo", Movie.movieFromJson) rentalRepo = JsonRepo(self.__settings["rentals"], "Rental repo", Rental.rentalFromJson) if self.__settings['repository'] == "sql": clientRepo = SqlRepo(config, Client, Client.clientToSql, "client", "(id,name)") movieRepo = SqlRepo(config, Movie, Movie.movieToSql, "movie", "(id,title,description,genre)") rentalRepo = SqlRepo( config, Rental, Rental.rentalToSql, "rental", "(id,movieId,clientId,rentedDate,dueDate,returnedDate)") mc = MovieController(movieRepo) cc = ClientController(clientRepo) rc = RentalController(rentalRepo, cc, mc) if self.__settings['ui'] == "console": console = Console.ConsoleUI(mc, cc, rc) console.mainMenu() if self.__settings['ui'] == 'gui': MainApp.clientController = cc MainApp.rentalController = rc MainApp.movieController = mc pyforms.startApp(MainApp)
import pyforms from mcvgui.core.editor.main_window import MainWindow #Execute the application if __name__ == "__main__": pyforms.startApp(MainWindow)
self._middlename = ControlText('Middle name') self._lastname = ControlText('Lastname name') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') #Define the button action self._button.value = self.__buttonAction def __buttonAction(self): """Button action event""" self._fullname.value = self._firstname.value +" "+ self._middlename.value + \ " "+ self._lastname.value ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": import pyforms pyforms.startApp( SimpleExample1 )
@property def images(self): return self._images.value @property def selected_data(self): videos = self._videos.value images = self._images.value res = [] for video in videos: images_list = [] for img in video.images: images_list.append(img) res.append((video, images_list)) return res @property def selected_video(self): ########################################### # current mouse selected video ########################################### index = self._videos.selected_row_index if index < 0: return None video, selected = self._videos.items[index] return video if __name__ == "__main__": pyforms.startApp(ImagesDialog)
from pyforms import conf as settings from pythonvideoannotator.VideoAnnotationEditor import VideoAnnotationEditor # create logger logger = logging.getLogger("pythonvideoannotator") logger.setLevel(logging.DEBUG) # create file handler which logs even debug messages fh = logging.FileHandler('{0}.log'.format(settings.LOG_FILENAME)) fh.setLevel(settings.APP_LOG_HANDLER_FILE_LEVEL) # create console handler with a higher log level ch = logging.StreamHandler() ch.setLevel(settings.APP_LOG_HANDLER_CONSOLE_LEVEL) # create formatter and add it to the handlers formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(name)s | %(module)s | %(funcName)s | %(message)s', datefmt='%d/%m/%Y %I:%M:%S') fh.setFormatter(formatter) ch.setFormatter(formatter) # add the handlers to the logger logger.addHandler(fh) logger.addHandler(ch) logger.debug("log pythonvideoannotator is now set up") logger.info("Starting pythonVideoAnnotator") pyforms.startApp(VideoAnnotationEditor, geometry=(settings.WINDOW_SIZE[0], settings.WINDOW_SIZE[1], settings.WINDOW_SIZE[2], settings.WINDOW_SIZE[3]))
class SimpleExample1(BaseWidget): def __init__(self): super(SimpleExample1, self).__init__('Simple example 1') #Definition of the forms fields self._firstname = ControlText('First name', 'Default value') self._middlename = ControlText('Middle name') self._lastname = ControlText('Lastname name') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') #Define the button action self._button.value = self.__buttonAction def __buttonAction(self): """Button action event""" self._fullname.value = self._firstname.value +" "+ self._middlename.value + \ " "+ self._lastname.value ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(SimpleExample1)
self._formset = [ { 'Antibody':['_ABFolder','_ABLabEff','_AB1LabPerLoc','_AB2LabPerLoc','_ABFlPerLabMin','_ABFlPerLabMax','_ABsize'],#,'||','_middlename','||','_lastname'], 'Nanobody':['_NBFolder','_NBLabEff','_NB1LabPerLoc','_NB2LabPerLoc','_NBFlPerLabMin','_NBFlPerLabMax','_NBsize'],#,'||','_middlename','||','_lastname'], 'Fluorescent Protein':['_FPFolder','_FPLabEff','_FP1LabPerLoc','_FP2LabPerLoc','_FPFlPerLabMin','_FPFlPerLabMax','_FPsize'],#,'||','_middlename','||','_lastname'] }, '=', '_MFilLth','_TrueSpc','_Iter', '_BundleSpacing','_BundleNum','_RendRes','||','_checkboxList', '=', (' ','_button', ' ') ] def __buttonAction(self): FileCFG='varCFG.py' SimRun='LabelingSimulationRun.py' #print(self._checkboxList.value) """Button action event""" #self.saveWindow() execfile(FileCFG) #print(self._FPFolder, self._NB2LabPerLoc,self._ABLabEff) execfile(SimRun)#os.system("python LabelingSimulation.py")#self._fullname.value = self._firstname.value +" "+ self._middlename.value +" "+self._lastname.value for katSlf in self._checkboxList.value: ExtraRun=katSlf+'Run.py' print(ExtraRun) execfile(str(ExtraRun)) #Execute the application if __name__ == "__main__": Var = pyforms.startApp( FilamentSimulationGUI )
'Calibrar': self.__dummyEvent }, '-', { 'Modificar': self.__dummyEvent }] }, { 'Ayuda': [{ 'Ayuda': self.__dummyEvent }, { 'Acerca de Triada': self.__dummyEvent }] }] ###10750586 def __dummyEvent(self): print("Menu option selected") ################################################################################################################## ################################################################################################################## ################################################################################################################## nombre = u'David' apellido1 = u'Ávila' apellido2 = u'Quezada' edad = '24' #Execute the application if __name__ == "__main__": pyforms.startApp(Triada)
self._update_name = False def save(self, project_path=None): if project_path: Project.save(self, project_path) elif self.path: Project.save(self, self.path) else: folder = QFileDialog.getExistingDirectory( self, "Select a directory to save the project: {0}".format( self.name)) if folder: folder = os.path.join(folder, self.name) try: Project.save(self, str(folder)) except FileExistsError as err: logger.warning(str(err)) QMessageBox.warning( self, 'Project exists', 'Project with same name already exists. Please select another path.' ) def close(self, silent=False): self.projects -= self super(ProjectWindow, self).close(silent) # Execute the application if __name__ == "__main__": app.startApp(ProjectWindow)
########################################### index = self._videos.selected_row_index if index < 0: return None video, selected = self._videos.items[index] return video @property def selected_data(self): videos = self._videos.value objects = self._objects.value res = [] for video in videos: objects_list = [] for obj in video.objects: if obj in objects: objects_list.append(obj) res.append((video, objects_list)) return res @property def objects_filter(self): return self._objects_filter @objects_filter.setter def objects_filter(self, value): self._objects_filter = value if __name__ == "__main__": pyforms.startApp(ObjectsDialog)
class PriceGuide(BaseWidget): def __init__(self): super(PriceGuide, self).__init__('OSRS Price Guide') #Definition of the forms fields self._itemname = ControlText('Item Name', 'Iron Arrow') self._price = ControlText('Item Price') self._button = ControlButton('Look up Price') #Define the button action self._button.value = self.__buttonAction self._formset = [('_itemname', '_button'), '_price', ' '] self.price_finder = PriceLookup() def __buttonAction(self): """Button action event""" price = self.price_finder.getGEPrice(self._itemname.value) if price < 0: self._price.value = self.price_finder.getSuggestionMessge( self._itemname.value) else: self._price.value = price #Execute the application if __name__ == "__main__": pyforms.startApp(PriceGuide)
if kill: dialog.destroy() else: self._eventList.__sub__(deleteRow) del Globals.globalEventList[deleteRow] print(Globals.globalEventList) def saveButtonListener(self): saveButtonValueMemory = self._saveButton.value while(True): if saveButtonValueMemory != self._saveButton.value: file = open(self._saveButton.value, 'w') file.write(str(Globals.globalEventList)) file.close() saveButtonValueMemory = self._saveButton.value def loadButtonListener(self): loadButtonValueMemory = self._loadButton.value while(True): if loadButtonValueMemory != self._loadButton.value: file = open(self._loadButton.value, 'r') listVal = ast.literal_eval(file.read()) Globals.globalEventList = listVal self._eventList.value = listVal file.close() loadButtonValueMemory = self._loadButton.value if __name__ == "__main__": pyforms.startApp(Programming)
from Core.BaseWindow import BaseWindow class MainWindow(BaseWindow): def __init__(self): super(MainWindow, self).__init__() # self.loadWindowData('teste.txt') ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(MainWindow)
# For compatibility with python 3 def __next__(self): return self.next() def next(self): if self._spamreader != None: row = self._spamreader.next() return [row[col] for col in self._cols] else: raise StopIteration() def __refreshPreview(self): if self._filename.value != None and self._filename.value != '': with open(self._filename.value, 'U') as csvfile: spamreader = csv.reader(csvfile, delimiter=self._separator.value) self._filePreview.value = [] self._filePreview.horizontalHeaders = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", ] for i, row in enumerate(spamreader): self._filePreview += row if i >= 10: break ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(CsvParserDialog, geometry=(0, 0, 600, 400))
# More accurate sleep, thanks to StackOverflow 17499837. Takes CPU, but that is required to be accurate. def busy_wait(self, waitTime): current_time = time.time() while (time.time() < current_time+waitTime): pass def runProgramAction(self): global playing if Globals.programRunning and playing: print("Stopping Program") Globals.programRunning = False playing = False self._runProgram.label="Run Program" else: print("Running Program") Globals.programRunning = True playing = True # Start Metronome global metronomeSoundThread metronomeSoundThread = threading.Thread(name='metronomeSoundThread', target=Metronome.metronomeSound, args=(self,)) metronomeSoundThread.setDaemon(True) metronomeSoundThread.start() self._runProgram.label="Stop Program" if __name__ == "__main__": pyforms.startApp(Metronome)
items2remove = [] for i, (item, checked) in enumerate(self._paths.items): if item.object2d==obj: items2remove.append(i) for i in sorted(items2remove,reverse=True): self._paths -= i ########################################################################### ### PROPERTIES ############################################################ ########################################################################### @property def video_filename(self): return None @video_filename.setter def video_filename(self, value): self._panel.value.video_filename = value self._start.max = self._panel.value.total_n_frames self._end.max = self._panel.value.total_n_frames @property def paths(self): return self._paths.value @paths.setter def paths(self, value): self._paths.value = value def save(self, data): return data def load(self, data): pass if __name__ == "__main__": pyforms.startApp(RegionsFilter)
from pyforms.Controls import ControlButton ############################################ class SimpleExample1(BaseWidget): def __init__(self): super(SimpleExample1,self).__init__('Simple example 1') #Definition of the forms fields self._firstname = ControlText('First name', 'Default value') self._middlename = ControlText('Middle name') self._lastname = ControlText('Lastname name') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') #Define the button action self._button.value = self.__buttonAction self._formset = ['_firstname','_middlename','_lastname', '_fullname', '_button', ' '] def __buttonAction(self): """Button action event""" self._fullname.value = self._firstname.value +" "+ self._middlename.value + \ " "+ self._lastname.value #Add this line to the constructor and you will be able to organize the forms. ################################### #Execute the application if __name__ == "__main__": pyforms.startApp( SimpleExample1 )
class EmailGUI(BaseWidget): def __init__(self): super(EmailGUI,self).__init__('EmailGUI') #Definition of the forms fields self._email = ControlText('Email', '*****@*****.**') self._password = ControlText('Password') self._receivers = ControlText('Recipients') self._message = ControlText('Message') self._buttonLogin = ControlButton('Login') self._buttonSend = ControlButton('Send') #Define the organization of the forms self._formset = [{'Tab1':['_email','||','_password','=',(' ','_buttonLogin', ' ')],'Tab2': ['_receivers','||','_message','=',(' ','_buttonSend', ' ')]}] #Use dictionaries for tabs #Use the sign '=' for a vertical splitter #Use the signs '||' for a horizontal splitter #Define the button action self._buttonLogin.value = self.__buttonLoginAction self._buttonSend.value = self.__buttonLoginAction def __buttonLoginAction(self): """Button action event""" def __buttonSendAction(self): """ """ #Execute the application if __name__ == "__main__": pyforms.startApp(EmailGUI)
from pyforms.Controls import ControlButton from pyforms.Controls import ControlTree class ProjectTree(BaseWidget): def __init__(self): super(ProjectTree, self).__init__('Project') self._addButton = ControlButton('Add') self._projectTree = ControlTree('Project tree') root = QtGui.QTreeWidgetItem(self._projectTree, ["root"]) A = QtGui.QTreeWidgetItem(root, ["A"]) barA = QtGui.QTreeWidgetItem(A, ["bar", "i", "ii"]) bazA = QtGui.QTreeWidgetItem(A, ["baz", "a", "b"]) self._projectTree.showHeader = False self._formset = [ (' ','_addButton'), '_projectTree'] ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": pyforms.startApp( ProjectTree )
#self._mdiArea.showCloseButton = False self._addWindow.value = self.__addWindow self.mainmenu.append( { 'File': [ {'Save as': self.saveWindow}, {'Open as': self.loadWindow}, '-', {'Exit': self.__exit}, ] } ) def __addWindow(self): self._simple = SimpleExample1(); self._mdiArea += self._simple def __exit(self): exit() ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": pyforms.startApp( BaseWindow )
import pyforms from geometry_designer.modules.geometry_manual_designer.GeometryManualDesigner import GeometryManualDesigner class GeometryDesigner(GeometryManualDesigner): """Application form""" def __init__(self): super(GeometryDesigner, self).__init__('Geometry designer') #self._video.value = '/home/ricardo/bitbucket/single-fly-tracker/Circle_and_Square.avi' ################################################################################################################## ################################################################################################################## ################################################################################################################## if __name__ == "__main__": pyforms.startApp( GeometryDesigner )
def start(): pyforms.startApp(VideoAnnotationEditor)
capture=video.video_capture, gaussianBlurMatrixSize=self._matrixSize.value, gaussianBlursigmaX=self._sigmaX.value, update_function=self.__update_image_event) bg.detect(self._jump_2_frame.value, self._cmp_jump.value, self._threshold.value) image = video.create_image() image.name = 'background-{0}'.format(len(list(video.images))) image.image = bg.background_color self._base_nframes += video.total_frames self._panel.enabled = True self._image.enabled = True self._matrixSize.enabled = True self._sigmaX.enabled = True self._jump_2_frame.enabled = True self._cmp_jump.enabled = True self._threshold.enabled = True self._apply.label = 'Apply' exit = self._apply.checked self._apply.checked = False self._progress.hide() #if exit: self.close() if __name__ == '__main__': pyforms.startApp(TrackingWindow)
self._lastnameField = ControlText('Lastname name') self._fullnameField = ControlText('Full name') self._buttonField = ControlButton('Press this button') #Define the button action self._buttonField.value = self.buttonAction self._formset = ['_firstnameField', '_middlenameField', '_lastnameField', '_fullnameField', (' ','_buttonField', ' '), ' '] def buttonAction(self): self._firstName = self._firstnameField.value self._middleName = self._middlenameField.value self._lastName = self._lastnameField.value self._fullnameField.value = self.fullName #In case the window has a parent if self.parent!=None: self.parent.addPerson(self) def printFullName(self): print( self._fullnameField.value) ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": pyforms.startApp( PersonWindow )
folder = os.path.join(videofolder, dataset.object2d.name, dataset.name, foldername) imgpath = os.path.join(folder, '{0}.png'.format(i) ) if not os.path.exists(folder): os.makedirs(folder) if self._usecut.value and self._imagesize.value>0: x, xx = self._cutx.value y, yy = self._cuty.value img = img[int(y):int(yy), int(x):int(xx)] cv2.imwrite(imgpath, img) self._progress.value += 1 self._apply.label = 'Apply' self._toolbox.enabled = True self._exportdir.enabled = True self._apply.checked = False self._progress.hide() if __name__ == '__main__': pyforms.startApp(ContoursImagesWindow)
self._buttonField = ControlButton('Press this button') #Define the button action self._buttonField.value = self.buttonAction self._formset = [ '_firstnameField', '_middlenameField', '_lastnameField', '_fullnameField', (' ', '_buttonField', ' '), ' ' ] def buttonAction(self): self._firstName = self._firstnameField.value self._middleName = self._middlenameField.value self._lastName = self._lastnameField.value self._fullnameField.value = self.fullName #In case the window has a parent if self.parent != None: self.parent.addPerson(self) def printFullName(self): print(self._fullnameField.value) ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": pyforms.startApp(PersonWindow)
if self._loaded and index is not None: graph = self._timeline._charts[index] logger.debug('Before: Min: {0} | Max: {1} Zoom: {2}'.format(graph.graph_min, graph.graph_max,graph.zoom ) ) graph.name = self._name.value; self._graphs_list.setValue(0, index, self._name.value) graph.graph_min = self._min_value.value graph.graph_max = self._max_value.value graph.zoom = self._values_zoom.value / 100.0 graph.top = self._values_top.value logger.debug('Min: {0} | Max: {1} Zoom: {2}'.format(graph.graph_min, graph.graph_max,graph.zoom ) ) self._timeline.repaint() @property def charts(self): return self._timeline._charts ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(GraphsProperties, geometry=(0, 0, 600, 400))
ys = savitzky_golay(ys, winsize, self._order.value, self._deriv.value, self._rate.value) for index in range(begin, end): pos = dataset.get_position(index) if pos is not None: dataset.set_position(index, xs[index], ys[index]) self._progress.value = count count += 1 elif isinstance(dataset, Value): xs = np.array(values) xs = savitzky_golay(xs, winsize, self._order.value, self._deriv.value, self._rate.value) for index in range(begin, end): val = dataset.get_value(index) if val is not None: dataset.set_value(index, xs[index]) self._progress.value = count count += 1 self._datasets_panel.enabled = True self._apply.label = 'Apply' self._apply.checked = False self._progress.hide() if __name__ == '__main__': pyforms.startApp(SmoothPathsWindow)
def __init__(self): super(HTCondorEnergyPlus,self).__init__('HTCondor & EnergyPlus') self._CSVFile = ControlFile('CSV File') self._Create = ControlButton('Create') self._Submit = ControlButton('Submit') self._Close = ControlButton('Close') self._Delete = ControlButton('Delete') self._formset = ['',(' ','_CSVFile',' '),('', '_Create', '_Submit','_Delete', '' ),('','_Close',''),''] self._Create.value = self.__CreateAction self._Close.value = self.__CloseAction self._Submit.value = self.__SubmitAction self._Delete.value = self.__DeleteAction def __CreateAction(self): CreateBatch.CreateBatch(self._CSVFile.value) def __SubmitAction(self): SubmitJobs.SubmitJobs() def __DeleteAction(self): DeleteJobs.DeleteJobs() def __CloseAction(self): sys.exit() if __name__ == "__main__": pyforms.startApp( HTCondorEnergyPlus )
@property def scorer(self): return self._scorer @scorer.setter def scorer(self, value): self._scorer = value @property def videos(self): return self._videos @videos.setter def videos(self, value): self._videos = value @property def bodyparts(self): return self._bodyparts @bodyparts.setter def bodyparts(self, value): self._bodyparts = value def __apply_event(self): pass if __name__ == '__main__': pyforms.startApp(DeepLabWindow)
def __show_bad_post_action(self): def callback(posts): self.bad_posts = posts self._bad_posts.value = [ (GroupBot.get_link_from_post(post, CONFIG['group_name']), True) for post in posts ] self._show_button.enabled = True def run_bot(): bot = create_bot_from_config() return bot.get_bad_posts() self._show_button.enabled = False self.pool.apply_async(run_bot, callback=callback) def __show_link_action(self, link): webbrowser.open(link.text()) def __remove_action(self): checked_posts = [ self.bad_posts[idx] for idx in self._bad_posts.checkedIndexes ] bot = create_bot_from_config() bot.remove_posts(checked_posts) if __name__ == "__main__": pyforms.startApp(GroupCheckerGui)
slice_size = X.shape[0] / self._k # 2 if self._pername.value not in self.learned: label = len(self.learned) + 1 self.learned[self._pername.value] = label else: return for i in range(self._k): sliced = np.delete(X, slice(i*2, (i*2)+2), axis=0) self.training_X[i] = np.append(self.training_X[i], sliced, axis=0) y = np.empty((sliced.shape[0], 1)) y.fill(label) self.training_y[i] = np.append(self.training_y[i], y, axis=0) print self.training_X[i].shape self._totrainlist.__add__([self._pername.value]) with open('learned.json', 'w') as learned_file: learned_file.write(json.dumps(self.learned)) ############ for i in range(self._k): self.cross_validation_set[i] = np.append(self.cross_validation_set[i], self.cross_validation[i]) self.cross_validation_set_y[i] = np.append(self.cross_validation_set_y[i], [label]*self.cv_size[i]) self.test_set = np.append(self.test_set, self.testingsetimage) self.testing_y = np.append(self.testing_y, [label]*(len(self.testingsetimage))) if __name__ == '__main__': pyforms.startApp(YourFaceSoundsFamiliar)
def xColumn(self): return self._xCol.value @property def yColumn(self): return self._yCol.value @property def zColumn(self): if self._showZ.value: return self._zCol.value else: return None def __refreshPreview(self): if self._filename.value != None and self._filename.value != '': with open(self._filename.value) as csvfile: spamreader = csv.reader(csvfile, delimiter=self._separator.value) self._filePreview.value = [] self._filePreview.horizontalHeaders = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", ] for i, row in enumerate(spamreader): self._filePreview += row if i >= 10: break ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": pyforms.startApp(ChooseColumnsWindow)
set2 = datasets[d2_index] val = set1.object2d.create_value() val.name = "distance-between ({0}) and ({1})".format( set1.name, set2.name) for index in range(begin, end): if not self._apply.checked: break pos1 = set1.get_position(index) if pos1 is None: continue pos2 = set2.get_position(index) if pos2 is None: continue dist = pts_utils.lin_dist(pos1, pos2) val.set_value(index, dist) self._progress.value = count count += 1 count = d1_index * d2_index * (end - begin + 1) self._datasets_panel.enabled = True self._apply.label = 'Apply' self._apply.checked = False self._progress.hide() if __name__ == '__main__': pyforms.startApp(DistancesWindow)
], track=currentTrack) currentTrack = 1 for index in range(0, len(values), 2): row0 = values[index] row1 = values[index + 1] if row0[0] not in eventsTypes: eventsTypes[row0[0]] = currentTrack track = currentTrack currentTrack += 1 else: track = eventsTypes[row0[0]] self._timeline.addPeriod([row0[1], row1[1], row0[0]], track=track) self.close() # pylint: disable=no-member ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(ImportWindow, geometry=(0, 0, 600, 400))
# im.putpixel( (i,j), (color_value+self._redSlider.value-(self._redSliderTwo.value-self._brightnessSlider.value), color_value+self._greenSlider.value-(self._greenSliderTwo.value-self._brightnessSlider.value), color_value+self._blueSlider.value-(self._blueSliderTwo.value-self._brightnessSlider.value))) im.putpixel( (i, j), (colorFinder(self._redSlider.value, self._redSliderTwo.value, color_value) - (255 - self._brightnessSlider.value), colorFinder(self._greenSlider.value, self._greenSliderTwo.value, color_value) - (255 - self._brightnessSlider.value), colorFinder(self._blueSlider.value, self._blueSliderTwo.value, color_value) - (255 - self._brightnessSlider.value))) im.show(title="Generated Set") def colorFinder(c1, c2, stage): step = float(abs(float(c1) - float(c2)) / 255) c1 = 255 - c1 c2 = 255 - c2 if c1 < c2: return int(c1 + (step * stage)) else: return int(255 - (c2 + (step * stage))) if __name__ == "__main__": pyforms.startApp(UI)
found_points.append(node.point) for point in self.quad_points(self._qt): color = 'og' if point in found_points else 'ob' q_plain_ax.plot([point[0]], [point[1]], color) if self.find_stage == FIND2 or self.find_stage == DISPLAYING: q_plain_ax.plot((self.find_frm[0], self.find_frm[0]), (self.find_frm[1], self.find_to[1]), 'r-') q_plain_ax.plot((self.find_frm[0], self.find_to[0]), (self.find_to[1], self.find_to[1]), 'r-') q_plain_ax.plot((self.find_to[0], self.find_to[0]), (self.find_to[1], self.find_frm[1]), 'r-') q_plain_ax.plot((self.find_to[0], self.find_frm[0]), (self.find_frm[1], self.find_frm[1]), 'r-') elif self.find_stage == FIND1: q_plain_ax.plot([self.find_points[0][0]], [self.find_points[0][1]], 'ok') self._q_plain_fig.canvas.draw() def _refresh_graphs(self): self._refresh_kd_structure() self._refresh_kd_plain() self._refresh_q_structure() self._refresh_q_plain() g = GUI pyforms.startApp(g)
self._papers_result.readOnly = True self._papers_result.currentCellChanged = self.__paper_selected self._papers_displayed = [] self.formset = ['_query', ('_pages_result', '_papers_result')] def __enter_pressed_event(self, e): if e.key() == QtCore.Qt.Key_Return: query = query_words(self._query.value) self._pages_displayed, self._papers_displayed = process_query(query, self._query.value) self._pages_result.clear() self._pages_result.value = [(QtGui.QLabel(format_text(query, document, 'pages')),) for document in self._pages_displayed] self._pages_result.resizeRowsToContents() self._papers_result.clear() self._papers_result.value = [(QtGui.QLabel(format_text(query, document, 'papers')),) for document in self._papers_displayed] self._papers_result.resizeRowsToContents() def __page_selected(self, next_row, unused1, unused2, unused3): open_url(self._pages_displayed[next_row]['url']) def __paper_selected(self, next_row, unused1, unused2, unused3): open_url(self._papers_displayed[next_row]['url']) if __name__ == '__main__': pyforms.startApp(Interface)
from PyQt4 import QtGui, QtCore from pyforms.Controls import ControlText from pyforms.Controls import ControlButton from pyforms.Controls import ControlTree class ProjectTree(BaseWidget): def __init__(self): super(ProjectTree, self).__init__('Project') self._addButton = ControlButton('Add') self._projectTree = ControlTree('Project tree') root = QtGui.QTreeWidgetItem(self._projectTree, ["root"]) A = QtGui.QTreeWidgetItem(root, ["A"]) barA = QtGui.QTreeWidgetItem(A, ["bar", "i", "ii"]) bazA = QtGui.QTreeWidgetItem(A, ["baz", "a", "b"]) self._projectTree.showHeader = False self._formset = [(' ', '_addButton'), '_projectTree'] ################################################################################################################## ################################################################################################################## ################################################################################################################## #Execute the application if __name__ == "__main__": pyforms.startApp(ProjectTree)
last = 0 final = [] for k, i in enumerate(events_occur): if (i - prev) > 1: final.append(events_occur[last:k]) last = k prev = i final.append(events_occur[last:]) return list(occur for occur in final if occur[0] >= frames_threshold_first_index and occur[0] < frames_threshold_last_index) def __generate_graph(self): self.__do_the_calculations() self._graph.value = self._values2display self._graph.legends = self._legends def _get_all_events(self): self._time = self._parent res = [] for track in self._time.tracks: for delta in track._events: res.append(delta) return res if __name__ == "__main__": pyforms.startApp(Stats)
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", ] for i, row in enumerate(spamreader): self._filePreview += row if i >= 10: break ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(CsvParserDialog, geometry=(0, 0, 600, 400))
self.add_contours(self._contours) def add_contours(self, contours): pass def __filename_changed(self): self._player.value = self._filename.value def __processFrame(self, frame): _, threshold = cv2.threshold(frame, self._threshold.value, 255, 0) gray = cv2.cvtColor(threshold, cv2.COLOR_BGR2GRAY) _, blobs, dummy = cv2.findContours(gray.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) threshold[:, :, 0] = 0 threshold[:, :, 1] = 0 dst = cv2.addWeighted(frame, 0.7, threshold, 0.3, 0) self._contours = [] for contour in blobs: contour = cv2.approxPolyDP(contour, self._epsilon.value, True) self._contours.append(contour) cv2.polylines(dst, contour, True, (0, 255, 0), 11) cv2.polylines(dst, np.array([contour]), True, (0, 255, 0), 1) return dst if __name__ == "__main__": pyforms.startApp(GeometryFromThreshold)
self._peopleList += [person._firstName, person._middleName, person._lastName] person.close() # After adding the person close the window def removePerson(self, index): """ Reimplement the removePerson function from People class to update the GUI everytime a person is removed. """ super(PeopleWindow, self).removePerson(index) self._peopleList -= index def __addPersonBtnAction(self): """ Add person button event. """ # A new instance of the PersonWindow is opened and shown to the user. win = PersonWindow() win.parent = self win.show() def __rmPersonBtnAction(self): """ Remove person button event """ self.removePerson(self._peopleList.mouseSelectedRowIndex) # Execute the application if __name__ == "__main__": pyforms.startApp(PeopleWindow)
ntracks = len(set([x[0] for x in values])) # collapse events = [] eventsTypes = {} currentTrack = 0 for index in range(0, len(values), 2): row0 = values[index] row1 = values[index + 1] if row0[0] not in eventsTypes: eventsTypes[row0[0]] = currentTrack track = currentTrack currentTrack += 1 else: track = eventsTypes[row0[0]] self._timeline.addPeriod([row0[1], row1[1], row0[0]], track=track) self.close() ################################################################################################################## ################################################################################################################## ################################################################################################################## # Execute the application if __name__ == "__main__": import pyforms pyforms.startApp(ImportWindow, geometry=(0, 0, 600, 400))
import cv2, pyforms from mcvgui.filters.adaptative_threshold import AdaptativeThreshold #mask = PolygonsMask(polygons_file='/home/ricardo/bitbucket/geometry-designer/arena.dat') #mask = AdaptativeThreshold() mask = pyforms.startApp(AdaptativeThreshold) cap = cv2.VideoCapture('/home/ricardo/Desktop/01Apollo201403210900/01Apollo201403210900MergedCascata.MP4') while cap.isOpened(): ret, frame = cap.read() frame = mask.processflow(frame) #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release()
""" prev = events_occur[0] last = 0 final = [] for k, i in enumerate(events_occur): if (i - prev) > 1: final.append(events_occur[last:k]) last = k prev = i final.append(events_occur[last:]) return list(occur for occur in final if occur[0] >= frames_threshold_first_index and occur[0] < frames_threshold_last_index) def __generate_graph(self): self.__do_the_calculations() self._graph.value = self._values2display self._graph.legends = self._legends def _get_all_periods(self): self._time = self._parent res = [] for track in self._time.tracks: for delta in track._periods: res.append(delta) return res if __name__ == "__main__": pyforms.startApp(Stats)
def __add_id_action(self): win = PopUpGetText('id', self.allowed_ids) win.show() def __remove_id_action(self): self.allowed_ids.remove(self._allowed_ids.mouseSelectedRowIndex) def __show_bad_post_action(self): def callback(posts): self.bad_posts = posts self._bad_posts.value = [(GroupBot.get_link_from_post(post, CONFIG['group_name']), True) for post in posts] self._show_button.enabled = True def run_bot(): bot = create_bot_from_config() return bot.get_bad_posts() self._show_button.enabled = False self.pool.apply_async(run_bot, callback=callback) def __show_link_action(self, link): webbrowser.open(link.text()) def __remove_action(self): checked_posts = [self.bad_posts[idx] for idx in self._bad_posts.checkedIndexes] bot = create_bot_from_config() bot.remove_posts(checked_posts) if __name__ == "__main__": pyforms.startApp(GroupCheckerGui)