class Controller: """Controller for the application""" def __init__(self, root): """Initialize the controller""" self.model = ApplicationManager() self.view = MainView(self, root) def calculate_price(self): """ Calculate the expected value of the booster box based on what is entered in the view entry widgets """ self.view.box_prc_msg = str(self.model.calc_ev(self.view.rarity_amts)) def get_set_names(self): """ Retrieves all set list names :return: A list of all set list names """ return self.model.set_names def update_current_set(self, event): """Updates the curr set information when a new list item is selected""" self.model.update_current_set(event) self.view.curr_set_msg = self.model.curr_set_message self.view.clear_set_info() self.view.update_set_info(self.model.rarities, self.model.avg_price_msg, self.model.num_cards_rarity, self.model.card_ratios)
class MainController: def __init__(self, inFile="", outFile="", viewOnly=False): self.myView = MainView(VIEW_WIDTH, VIEW_HEIGHT, self) if viewOnly: showingImage = True self.myView.showImage(inFile) self.run() def run(self): while True: FPSCLOCK.tick(FPS) if (FPSCLOCK.get_fps() < 30): print("Running slow...\nFPS: " + str(FPSCLOCK.get_fps())) if (showingImage): self.myView.updateImage() else: self.myView.update() if self.myView.needsRedraw(): DISPLAYSURF.blit(self.myView, (0,0)) pygame.display.update() def printHi(self): print('hi')
def run(self): mainWindow = MainView.GUI() self.Update.chkUpdate() mainWindow.run()
# Gestionale Servizi Medici # Version 1.0.0 # Developed by Alessio Rubicini, Andrea Malloni, Daniele Monaldi, Alessio Cinti, Matteo Di Perna # MainApp.py # Entry file for app configuration and startup # --------------- MODULES ----------------- from API import conf from API.Parsers import HTMLParser, LatexParser, XMLParser, CSVParser from View import MainView, Toolbar from Model import Company, Census, Employee # --------------- CONFIGURATION ----------------- config = conf.readConfig() # --------------- START APP ----------------- # Starting view view = MainView.MainView()
def Start(): mainView.mainView()
def __init__(self, inFile="", outFile="", viewOnly=False): self.myView = MainView(VIEW_WIDTH, VIEW_HEIGHT, self) if viewOnly: showingImage = True self.myView.showImage(inFile) self.run()
def __init__(self, root): """Initialize the controller""" self.model = ApplicationManager() self.view = MainView(self, root)
def fild_all_files(self, directory): u"""ビデオリスト取得のための関数.""" for root, dirs, files in os.walk(directory): yield root for file in files: yield os.path.join(root, file) def get_playlist(self, playdir): u"""ディレクトリ内のビデオのリストを取得.""" playlist = [] for file in self.fild_all_files(playdir): ext = splitext(basename(file))[1][1:].lower() # ピリオドを抜いた拡張子 if ext in self.settei.settings and self.settei.settings[ext]: playlist.append(file.replace('/', os.sep)) return playlist if __name__ == '__main__': u"""メイン.""" if len(sys.argv) > 1: settei = Settei() cui_ctrl = CuiController(settei) else: app = QtWidgets.QApplication(sys.argv) settei = Settei() main_view = MainView() main_ctrl = MainController(settei, main_view) main_view.show() sys.exit(app.exec_())