def results(): request.vars.zipped_files.file.seek(0) el152, el155, el68a = extractLogs([request.vars.zipped_files.file]) del request.vars.zipped_files # create parsed logs and delete files... p_el152 = p_el155 = p_el68a = None if el152: p_el152 = AuditLog(el152) del el152 if el155 and el68a: p_el68a = EL68A(el68a) del el68a p_el155 = BallotImage(el155, p_el152, p_el68a) del el155 elif el155 and not el68a: p_el155 = BallotImage(el155, p_el152) del el155 # parsed logs are passed to dispatcher dictionary = dispatcher(el152=p_el152, el155=p_el155, el68a=p_el68a) if dictionary['message'] != 'LOLCAT': generateImageIDs(dictionary['results']) generateTags(dictionary['results']) return dictionary
def run(log_level="INFO"): config = configuration.configuration() config.fileConfig(myglobal.LOGGINGINI) config.setValue("handler_fileHandler", "args", ('dispatcher.log', 'a')) config.setValue("handler_fileHandler", "level", log_level) config.setValue("handler_consoleHandler", "level", log_level) # logging.config.fileConfig(FILE_FOLDER + configuration.configuration("dispatcher.ini").getValue('Log','file')) logging.config.fileConfig(myglobal.LOGGINGINI) logger = logging.getLogger('main') d = dispatcher.dispatcher() while True: logger.info("Run periodically build and queue check.") #run scheduled build check d.scheduledCheck() #check the queue to see if any new job to do d.scanQueue() ''' #add nightly jobs only on designated time currentTime=time.strftime('%H%M',time.localtime()) scheduledTime=scheduled_nightly_time.replace(":","") if int(currentTime)>=int(scheduledTime) and int(currentTime)<(int(scheduledTime)+timeout/60): #print "It comes to the scheduled time, add nightly jobs." logger.info("It comes to the scheduled time, add nightly jobs.") d.addNightlyJobs() ''' #wait for a whole logger.info("Sleep for %i minutes" % (timeout / 60)) time.sleep(timeout) continue
def bot_send_message(message): print("\n", "-" * 50, "\nuser_id", message.from_user.id, "\nlogin", message.from_user.username, "\nusername", message.from_user.first_name, "\ndate", datetime.today(), "\ntext", message.text) new = dispatcher(message.from_user.id, message.text) new.dispatcher()
def callback_inline(call): print("\n----------------------------------------------------------------", "\nuser_id", call.from_user.id, "\nlogin", call.from_user.username, "\nusername", call.from_user.first_name, "\ndate", datetime.today(), "\ntext", call.data) new = dispatcher(call.from_user.id, call.data, call.message.message_id) new.dispatcher()
def main(): # Get options. opts = optparse.OptionParser(usage='%prog [options]') opts.add_option('--hostname', '-s', default='localhost',\ help='The hostname for the e-mail server to contact. Default: localhost.') opts.add_option('--port','-p',default=p.port,\ help='The port for IMAP4 communications. Default: %s.' % (p.port)) opts.add_option('--username', '-u', default=None, \ help='The username credentials for synchronization. Will ask if not specified.') options, arg = opts.parse_args() # Establish connection. socket = s.socket(s.AF_INET, s.SOCK_STREAM) # Set up socket. try: socket.connect( (options.hostname, int(options.port))) # Connect to server. except: print 'Connection binding failed when contacting %s:%s.' % ( options.hostname, options.port) exit() # Set up identifier tag for messages. tag = p.tag() # Create dispatcher to handle messages. dispatch = p.dispatcher(options.hostname, socket, tag) # Start TLS negotiations. req = p.request('STARTTLS') dispatch.sendMessage(req) # Wrap socket in SSL connection. socket = ssl.wrap_socket(socket, ssl_version=ssl.PROTOCOL_SSLv23) dispatch.socket = socket # Ask for username and password. if not options.username: username = raw_input('>> Username: '******'LOGIN', username, getpass.getpass('>> Password: '******'\nSecurely logged in as %s on hostname %s.' % (username, options.hostname) outOfMailbox(dispatch) # Log out of server. req = p.request('LOGOUT') dispatch.sendMessage(req) # Close socket. socket.close()
def main(): # Get options. opts = optparse.OptionParser(usage='%prog [options]') opts.add_option('--hostname', '-s', default='localhost',\ help='The hostname for the e-mail server to contact. Default: localhost.') opts.add_option('--port','-p',default=p.port,\ help='The port for IMAP4 communications. Default: %s.' % (p.port)) opts.add_option('--username', '-u', default=None, \ help='The username credentials for synchronization. Will ask if not specified.') options, arg = opts.parse_args() # Establish connection. socket = s.socket(s.AF_INET,s.SOCK_STREAM) # Set up socket. try: socket.connect((options.hostname,int(options.port))) # Connect to server. except: print 'Connection binding failed when contacting %s:%s.' % (options.hostname,options.port) exit() # Set up identifier tag for messages. tag = p.tag() # Create dispatcher to handle messages. dispatch = p.dispatcher(options.hostname,socket,tag) # Start TLS negotiations. req = p.request('STARTTLS') dispatch.sendMessage(req) # Wrap socket in SSL connection. socket = ssl.wrap_socket(socket,ssl_version=ssl.PROTOCOL_SSLv23) dispatch.socket = socket # Ask for username and password. if not options.username: username = raw_input('>> Username: '******'LOGIN',username,getpass.getpass('>> Password: '******'\nSecurely logged in as %s on hostname %s.' % (username,options.hostname) outOfMailbox(dispatch) # Log out of server. req = p.request('LOGOUT') dispatch.sendMessage(req) # Close socket. socket.close()
def index(): form = FORM( 'Zipped File:', INPUT(_name='zipped_files', _type='file'), INPUT(_type='submit')) if form.accepts(request.vars, session) and form.vars.zipped_files != '': form.vars.zipped_files.file.seek(0) try: el152, el155, el68a = extractLogs([form.vars.zipped_files.file], request.folder) except InvalidFilesException as e: session.file_error = str(e) redirect(URL('error')) finally: del form.vars.zipped_files # file name is in el152.name etc. # create parsed logs and delete files... p_el152 = p_el155 = p_el68a = None if el152: p_el152 = AuditLog(el152) os.unlink(os.path.join(request.folder, 'uploads', el152.name)) del el152 if el155 and el68a: p_el68a = EL68A(el68a) os.unlink(os.path.join(request.folder, 'uploads', el68a.name)) del el68a p_el155 = BallotImage(el155, p_el152, p_el68a) os.unlink(os.path.join(request.folder, 'uploads', el155.name)) del el155 elif el155 and not el68a: p_el155 = BallotImage(el155, p_el152) os.unlink(os.path.join(request.folder, 'uploads', el155.name)) del el155 # parsed logs are passed to dispatcher dictionary = dispatcher(el152=p_el152, el155=p_el155, el68a=p_el68a) if dictionary['message'] != 'LOLCAT': generateImageIDs(dictionary['results']) generateTags(dictionary['results']) session.results = dictionary redirect(URL('results')) return dict(message=None, form=form)
def index(): form = FORM('Zipped File:', INPUT(_name='zipped_files', _type='file'), INPUT(_type='submit')) if form.accepts(request.vars, session) and form.vars.zipped_files != '': form.vars.zipped_files.file.seek(0) try: el152, el155, el68a = extractLogs([form.vars.zipped_files.file], request.folder) except InvalidFilesException as e: session.file_error = str(e) redirect(URL('error')) finally: del form.vars.zipped_files # file name is in el152.name etc. # create parsed logs and delete files... p_el152 = p_el155 = p_el68a = None if el152: p_el152 = AuditLog(el152) os.unlink(os.path.join(request.folder, 'uploads', el152.name)) del el152 if el155 and el68a: p_el68a = EL68A(el68a) os.unlink(os.path.join(request.folder, 'uploads', el68a.name)) del el68a p_el155 = BallotImage(el155, p_el152, p_el68a) os.unlink(os.path.join(request.folder, 'uploads', el155.name)) del el155 elif el155 and not el68a: p_el155 = BallotImage(el155, p_el152) os.unlink(os.path.join(request.folder, 'uploads', el155.name)) del el155 # parsed logs are passed to dispatcher dictionary = dispatcher(el152=p_el152, el155=p_el155, el68a=p_el68a) if dictionary['message'] != 'LOLCAT': generateImageIDs(dictionary['results']) generateTags(dictionary['results']) session.results = dictionary redirect(URL('results')) return dict(message=None, form=form)
def handler_date(text, context): today = datetime.date.today() match = re.match(re_date, text) if match: context['date'] = match[0] input_date = datetime.date(year=int(text[0:4]), month=int(text[5:7]), day=int(text[8:10])) if input_date >= today: dispatcher.dict_to_dispather['step3'] = text start_dispatcher = dispatcher.dispatcher() context['choose_ways'] = start_dispatcher[1] context['dispatcher_res_list'] = start_dispatcher[0] return True else: return False else: return False
def __initDispatcher(self): self.dispatcher = dispatcher(self.inputs) self.loginSer = login_service() self.roomSer = room_service() self.gameSer = game_service() self.dispatcher.register(1000, self.loginSer) self.dispatcher.register(2000, self.roomSer) self.dispatcher.register(2001, self.roomSer) self.dispatcher.register(2002, self.roomSer) self.dispatcher.register(2003, self.roomSer) self.dispatcher.register(2004, self.roomSer) self.dispatcher.register(3000, self.activitySer) self.dispatcher.register(3001, self.activitySer) self.dispatcher.register(3002, self.activitySer) self.dispatcher.register(3003, self.activitySer) self.dispatcher.register(3004, self.activitySer) self.dispatcher.register(3005, self.activitySer)
def generate_template(): _template = request.get_json() template = Template() template.set_version('2010-09-09') template.set_description(_template['description']) params = _template['parameters'] params = generateParams(params) for param in params: template.add_parameter(param) resources = _template['resources'] for resource in resources: template.add_resource(dispatcher(resource)) return template.to_dict()
def initApplication(self): global primaryScreen global _translate win = uic.loadUi(const.mainWindow) dispatch = dispatcher(win, self) dispatch.setAbout(self.about) primaryScreen = self.app.primaryScreen() scrSize = primaryScreen.size() win.move(scrSize.width() / 2 - win.width() / 2, scrSize.height() / 2 - win.width() / 2) win.setWindowTitle(_translate("mainWindow", "KSW_Gok")) win.menuFichier.setTitle(_translate("mainWindow", "Fic&hier")) win.actionQuitter.setText(_translate("mainWindow", "&Quitter")) win.menuHelp.setTitle(_translate("mainWindow", "Aide")) win.menuLangues.setTitle(_translate("mainWindow", "Langues")) win.actionQuitter.setText(_translate("mainWindow", "&Quitter")) win.actionApropos.setText(_translate("mainWindow", "A propos")) win.actionFran_ais.setText(_translate("mainWindow", "Français")) win.actionItalien.setText(_translate("mainWindow", "Italien")) win.actionAllemand.setText(_translate("mainWindow", "Allemand")) win.actionAnglais.setText(_translate("mainWindow", "Anglais")) win.actionPr_ferences.setText( _translate("mainWindow", "Préferences...")) self.win = win self.status = win.statusBar() self.status.showMessage(_translate("main.py", "appReady")) self.dispatch = dispatch self.listener = listener() self.listener.setCallBack(dispatch.updateTank) win.actionQuitter.triggered.connect(self.listener.stopServer) win.actionApropos.triggered.connect(dispatch.doAbout) win.actionPr_ferences.triggered.connect(dispatch.doPreferences) self.win.tabTank.clear() self.listener.startServer()
def __init__(self): self.creator = dispatcher() self.mock_user_dict = {'chat_id': 1, 'text': ""}
self.userList = {} print 'Bad config file.' def exportIni(self, file): cf = ConfigParser.SafeConfigParser() cf.add_section('Player') cf.set('Player', 'userlist', json.dumps(self.userList)) with codecs.open(file, 'w+', encoding='utf-8') as f: cf.write(f) f.close() if __name__ == '__main__': # 任务处理分发器 dispatch = dispatcher() # 注册各类服务 dispatch.register(TableShowService.SERVICE_ID, TableShowService()) dispatch.register(ChessGameService.SERVICE_ID, ChessGameService()) dispatch.register(ChatService.SERVICE_ID, ChatService()) dispatch.register(TickService.SERVICE_ID, TickService()) server = Server_Launcher() while True: server.host.process() event, wparam, lparam, data = server.host.read() if event < 0: continue # 处理玩家数据 if event == NET_DATA: data = json.loads(data)
def clk(self, obj): print(str(obj.text) + ": Button Pressed") global state state = dispatcher(obj, state)
user_env_vars_from_appinfo(appinfo).iteritems()) # Also freeze environment data from env_config. This is added to the # environment in `reset_environment_middleware`. frozen_env_config_env = tuple( env_vars_from_env_config(env_config).iteritems()) # Monkey-patch os.environ to be thread-local. This is for backwards # compatibility with GAE's use of environment variables to store request data. # Note: gunicorn "gevent" or "eventlet" workers, if selected, will # automatically monkey-patch the threading module to make this work with green # threads. os.environ = ThreadLocalDict() # Create a "meta app" that dispatches requests based on handlers. meta_app = dispatcher(preloaded_handlers) # Wrap meta_app in middleware. The first statement in this section is the # innermost layer of the middleware, and the last statement is the outermost # layer (the middleware code that will process a request first). Inside the # innermost layer is the actual dispatcher, above. # Intercept health check requests on /_ah/health. This is a temporary measure # until container-level health check handlers are in place and turned on. meta_app = health_check_middleware(meta_app) # Reset os.environ to the frozen state and add request-specific data. meta_app = reset_environment_middleware(meta_app, frozen_environment, frozen_user_env, frozen_env_config_env)
#import positions import os import sys import signal import time JMRI_PORT = 12345 def signal_term_handler(signal, frame): print('got SIGTERM') stop_server.stop() time.sleep(1) args = parse_args() logger(console=args.log_to_console, trace=args.trace.split(',')) disp = dispatcher(args) constants.load_string(args.additional_args) if args.constants_file : constants.load_file(args.constants_file) if args.log_periodic : constants.log_section_status = constants.log_train_status = True if args.simulate : sim_controller() else : nce = nce_controller(args.nce) usb_listener.make_listeners(args.nce) while not nce.is_connected() or not usb_listener.all_connected() : pass load_layout(args.layout) print(section.dump_all()) #positions.load()
def set_loco(nn): l = get_loco(nn) n._set_loco(nn, l.speed, l.reverse, l.opts) l = logger(console=True) l._add_trace('controller') l._add_trace('serial') try: dev = sys.argv[1] except IndexError: dev = None d = dispatcher() n = nce_controller(dev) usb_listener.make_listeners() for i in range(12): sensor(str(i + 1)) curloco = 0 loco_infos = {} while True: cmd = input('command: ').strip() if cmd == '': break try: cmd0 = cmd[0] rest = cmd[1:].strip() if cmd0 == 'p':
def __init__(self): self.creator = dispatcher() self.mock_user_dict = { 'chat_id': 1, 'text': "" }
for k, v in p.iteritems(): setattr(env, k, v) return env # env_name = 'hopper' env_name = 'walker' run_dir = '/home/nir/work/git/Buffe/Applications/mgail/environments/' + env_name + '/' if env_name == 'hopper': config_dir = 'models/18T-2016-10-13-10-23-13/config_0/' sn = '2016-10-13-12-28-092000.sn' elif env_name == 'walker': config_dir = 'models/11T-2016-10-30-09-42-49/config_0/' sn = '2016-10-30-16-31-116000.sn' sys.path.append(os.getcwd() + '/environments/' + env_name) env = __import__('environment').ENVIRONMENT(run_dir) params = load_params(run_dir + config_dir) env = update_env_params(env, params) env.train_mode = False env.trained_model = run_dir + config_dir + sn dispatcher(env)
def update(self, dt): global state obj = "invalid" state = dispatcher(obj, state) BtnLayout.update(self.children[0].children[0])
import os import threading from multiprocessing import Process, Queue from time import sleep from telegram import Updater import dispatcher # Enable logging """logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG) """ TOKEN = os.environ.get('TELEGRAM_API_KEY') CREATOR = dispatcher.dispatcher() MESSAGE_QUEUE = Queue() FINISHED_MESSAGE_QUEUE = Queue() def return_messages(return_queue): def actually_return_messages(resp): m = resp[0] bot = resp[1] for text in m['response_list']: bot.sendMessage(chat_id=m['chat_id'], text=text, reply_markup=m['keyboard']) user_thread_dict = {}
# use to refresh the environment (via `reset_environment_middleware`) at the # beginning of each request. # It would be cleaner to take this snapshot earlier in the process, but app # preloading may trigger any arbitrary user code, including code that modifies # the environment, and we need to capture any results from that. frozen_environment = tuple(os.environ.iteritems()) # Monkey-patch os.environ to be thread-local. This is for backwards # compatibility with GAE's use of environment variables to store request data. # Note: gunicorn "gevent" or "eventlet" workers, if selected, will # automatically monkey-patch the threading module to make this work with green # threads. os.environ = ThreadLocalDict() # Create a "meta app" that dispatches requests based on handlers. meta_app = dispatcher(preloaded_handlers) # Wrap meta_app in middleware. The first statement in this section is the # innermost layer of the middleware, and the last statement is the outermost # layer (the middleware code that will process a request first). Inside the # innermost layer is the actual dispatcher, above. # Intercept health check requests on /_ah/health. This is a temporary measure # until container-level health check handlers are in place and turned on. meta_app = health_check_middleware(meta_app) # Reset os.environ to the frozen state and add request-specific data. meta_app = reset_environment_middleware(meta_app, frozen_environment, frozen_user_env, frozen_env_config_env)
from roundabout import ROUNDABOUT technion=1 if technion: git_path = '/home/nir/work/git/' else: git_path = '/homes/nirb/work/git/' sys.path.append(git_path + '/Buffe/utils') from dispatcher import dispatcher if __name__ == '__main__': train_params = { 'n_train_iters': 100000, 'test_interval': 500, 'n_steps_train': 100, 'n_steps_test': 150 } simulator = ROUNDABOUT() snapshots_dir = git_path + '/Buffe/Applications/SVG_INF/snapshots/' trained_model='' # trained_model='/homes/nirb/work/git/Buffe/Applications/SVG_INF/snapshots/2016-06-07-10-53-003500.sn' dispatcher(simulator=simulator, train_params=train_params, trained_model=trained_model, sn_dir=snapshots_dir)
import dispatcher import filePayload d = dispatcher.dispatcher() p = filePayload.filePayload('c:\\temp\\log_file.txt') d.dispatchViaEmail(p)
with open(fname + '/params.json', 'w') as f: json.dump(obj, f, indent=4, sort_keys=False) time_str = time.strftime("%Y-%m-%d-%H-%M-%S") if not os.path.exists(run_dir + n_trajs + 'T-' + time_str + '/'): os.makedirs(run_dir + n_trajs + 'T-' + time_str + '/') for i in xrange(1000): config_dir = run_dir + n_trajs + 'T-' + time_str + '/' + '/config_' + str(i) + '/' # create run dir if not os.path.exists(config_dir): os.makedirs(config_dir) with open(config_dir + 'log_file.txt', 'wb') as f: f.write('Log File...\n\n\n') params_i = drill_params(params) env = update_env_params(env, params_i) env.config_dir = config_dir # save params to config_dir save_params(params_i, config_dir) # run job env.log_fid = f dispatcher(env)
#!/usr/bin/env python import sys sys.path.append('/Users/zafaraliahmed/summer15/metastasis/') import dispatcher cpu=int(sys.argv[2]) #number of cpus to use # stores the commands we are going to run commandlist=[] # names of the simulations we are going to run simulation_names = sys.argv[3:] # number of times each simulation must be run num_times = int( sys.argv[1] ) for simulation in simulation_names: for i in range(num_times): #for bootnum in range(100): commandlist.append('~/CC3D_3.7.3/runScript.command -i ~/summer15/metastasis/'+simulation+'/'+simulation+'.cc3d') dispatcher.dispatcher(commandlist,slots=min(len(commandlist),cpu))
from config_parser import config_parser from arping import arping, device from dispatcher import dispatcher config_file = "pipaalarm.ini" config = config_parser(config_file) arping = arping(ip_range = config.getScanRange()) arping.monitored_devices |= ( set([device("", d[1]["mac"]) for d in config.getClients()]) ) dispatcher = dispatcher(config, arping.warnings)
technion = 1 if technion: git_path = '/home/nir/work/git/' else: git_path = '/homes/nirb/work/git/' sys.path.append(git_path + '/Buffe/utils') from dispatcher import dispatcher if __name__ == '__main__': train_params = { 'n_train_iters': 100000, 'test_interval': 500, 'n_steps_train': 100, 'n_steps_test': 150 } simulator = ROUNDABOUT() snapshots_dir = git_path + '/Buffe/Applications/SVG_INF/snapshots/' trained_model = '' # trained_model='/homes/nirb/work/git/Buffe/Applications/SVG_INF/snapshots/2016-06-07-10-53-003500.sn' dispatcher(simulator=simulator, train_params=train_params, trained_model=trained_model, sn_dir=snapshots_dir)
#!/usr/bin/python # # controller - main program # from parse_args import parse_args from dispatcher import dispatcher from load_layout import load_layout import logger p = parse_args() usb_listener.make_listeners(p.exclude) d = dispatcher(p) logger.log_init() load_layout(p.layout) d.start()
import sys import dispatcher if __name__ == '__main__': dispatcher.dispatcher(*sys.argv[1:])
def structure_the_unstructured(path, verbose, mongo, database_name, dataset_name, skip_duplicate, metrics_args): """main project function, migrates desired datasets into the mongoDB database and produces adequate reports""" # get db instance client, db, c_ds = get_mongo_client(mongo, database_name) migration_time = -timer() if verbose: print("Calculating Dataset hash") ds_hash = get_dataset_hash(path) if not skip_duplicate: if verbose: print("Checking for repeated imports...") identical_ds_cnt = c_ds.count_documents({"hash": ds_hash}) if identical_ds_cnt != 0: opt = input( "\nDataset '%s' was imported %s time(s) already.\nDo you wish to continue and import it again? (y/n) " % (path, identical_ds_cnt)) while True: if opt == "Y" or opt == "y": print("\nProceeding with import...\n") break if opt == "N" or opt == "n": print("\nAborting import...\n") return opt = input( "\nInvalid option. Options are:\n\t- Confirm dataset import - [Y/y]\n\t- Cancel dataset import - [N/n]\nOption: " ) create_report_folder() ds_id = c_ds.insert({ "_id": uuid4(), "className": "pt.fraunhofer.demdatarepository.model.dataset.Dataset", "name": dataset_name, "type": "Dataset", "hash": ds_hash }) client.close() d = dispatcher(verbose) # create a dispatcher instance users = {} global_metrics = {} # multiprocessing pool = multiprocessing.Pool() processes = [] for user, uf in get_all_direct_subfolders(path): processes.append( pool.apply_async(process_user, args=([ d, user, uf, verbose, metrics_args, mongo, database_name, ds_id ]))) for p in processes: # before producing the report, wait for workers user, result, subject = p.get() users[user] = (subject, result) update_global_migration_metrics(global_metrics, subject, len(processes)) migration_time = migration_time + timer() global_metrics['migration_time'] = migration_time produce_report(global_metrics, users)
# DATES : 4 jan 2016 # USE : Poll telegram API for incoming messages and forward them to core # after wrapping in a nice JSON format. # Owner : @v0dro import os import threading from multiprocessing import Process, Queue from time import sleep from telegram import Updater import dispatcher TOKEN = os.environ.get('TELEGRAM_API_KEY') CREATOR = dispatcher.dispatcher() MESSAGE_QUEUE = Queue() FINISHED_MESSAGE_QUEUE = Queue() def return_messages(return_queue): def actually_return_messages(resp): m = resp[0] bot = resp[1] for text in m['response_list']: bot.sendMessage( chat_id=m['chat_id'], text=text, reply_markup=m['keyboard']) user_thread_dict = {} while True:
import os technion=1 if technion: git_path = '/home/nir/work/git/' else: git_path = '/homes/nirb/work/git/' sys.path.append(git_path + '/Buffe/utils') sys.path.append(os.getcwd() + '/configurations') from dispatcher import dispatcher if __name__ == '__main__': # env_name = 'InvertedPendulum-v1' # env_name = 'InvertedDoublePendulum-v1' # env_name = 'Reacher-v1' env_name = 'BipedalWalker-v2' env = gym.make(env_name) config = __import__(env_name).CONFIGURATION() snapshots_dir = git_path + '/Buffe/Applications/SVG_1/snapshots/' trained_model = '' # trained_model='/homes/nirb/work/git/Buffe/Applications/SVG_INF/snapshots/2016-06-07-10-53-003500.sn' dispatcher(environment=env, configuration=config, trained_model=trained_model, sn_dir=snapshots_dir)
def initApplication(self): global primaryScreen win = uic.loadUi(const.mainWindow) dispatch = dispatcher(win, self) primaryScreen = self.app.primaryScreen() scrSize = primaryScreen.size() win.move(scrSize.width() / 2 - win.width() / 2, scrSize.height() / 2 - win.width() / 2) dispatch.resizeWindow() dispatch.setAbout(self.about) win.actionOuvrir.triggered.connect( lambda checked: self.app.import_file(win, self)) win.actionQuitter.triggered.connect(win.close) win.actionApropos.triggered.connect(dispatch.doAbout) win.actionSetting.triggered.connect(dispatch.doPreferences) win.DExcel.clicked.connect(dispatch.createExcel) win.DPdf.clicked.connect(dispatch.createPdf) win.v_cards.doubleClicked.connect(dispatch.editKey) now = (date.today()).replace(day=1) mn = now.month + 1 if mn > 12: fin = now.replace(year=now.year + 1, month=1) else: fin = now.replace(month=mn) win.DTDebut.setMaximumDate(fin) win.DTFin.setMaximumDate(fin) win.DDDebut.setMaximumDate(fin) win.DDFin.setMaximumDate(fin) mn = now.month - 1 if mn < 0: fin = now.replace(year=now.year - 1, month=12) else: fin = now.replace(month=mn) win.DTDebut.setDate(fin) win.DTFin.setDate(now) win.DDDebut.setDate(fin) win.DDFin.setDate(now) win.DTDebut.dateChanged.connect(dispatch.dateTransaction) win.DTFin.dateChanged.connect(dispatch.dateTransaction) win.DDDebut.dateChanged.connect(dispatch.dateDecompte) win.DDFin.dateChanged.connect(dispatch.dateDecompte) self.about.info.setText("Loading Cards information...") self.cards = t_cards(win, self.app) dispatch.setCards(self.cards) self.cards.loadCards() self.app.setCard(self.cards) self.about.info.setText("Creating Transactions...") self.app.showTransaction(win) self.about.info.setText("Creating Report...") self.about.update() sleep(2) self.app.showDecompte(win) self.win = win self.dispatch = dispatch