Exemple #1
0
def main():
    if sys.platform == 'darwin':
        from Foundation import NSBundle
        bundle = NSBundle.mainBundle()
        if bundle:
            info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
            info['CFBundleName'] = 'Qiskit Aqua'
    
    root = tk.Tk()
    root.withdraw()
    root.update_idletasks()
    
    preferences = UIPreferences()
    geometry = preferences.get_run_geometry()
    if geometry is None:
        ws = root.winfo_screenwidth()
        hs = root.winfo_screenheight()
        w = int(ws / 1.3)
        h = int(hs / 1.3)
        x = int(ws/2 - w/2)
        y = int(hs/2 - h/2)
        geometry = '{}x{}+{}+{}'.format(w,h,x,y)
        preferences.set_run_geometry(geometry)
        preferences.save()
    
    root.geometry(geometry)
    
    # update logging setting with latest external packages
    preferences = Preferences()
    logging_level = logging.INFO
    if preferences.get_logging_config() is not None:
        set_logging_config(preferences.get_logging_config())
        logging_level = get_logging_level()
        
    preferences.set_logging_config(build_logging_config(logging_level))
    preferences.save()
    
    set_logging_config(preferences.get_logging_config())
    
    MainView(root)
    root.after(0, root.deiconify)
    root.mainloop()
Exemple #2
0
def main():
    if sys.platform == 'darwin':
        from Foundation import NSBundle
        bundle = NSBundle.mainBundle()
        if bundle:
            info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
            info['CFBundleName'] = 'Qiskit Aqua'
    
    root = tk.Tk()
    root.withdraw()
    root.update_idletasks()
    
    preferences = UIPreferences()
    geometry = preferences.get_browser_geometry()
    if geometry is None:
        ws = root.winfo_screenwidth()
        hs = root.winfo_screenheight()
        w = int(ws / 1.2)
        h = int(hs / 1.3)
        x = int(ws/2 - w/2)
        y = int(hs/2 - h/2)
        geometry = '{}x{}+{}+{}'.format(w,h,x,y)
        preferences.set_browser_geometry(geometry)
        preferences.save()
    
    root.geometry(geometry)
      
    preferences = Preferences()
    if preferences.get_logging_config() is None:
        logging_config = build_logging_config(['qiskit_aqua'],logging.INFO)
        preferences.set_logging_config(logging_config)
        preferences.save()
    
    set_logger_config(preferences.get_logging_config())
         
    MainView(root)
    root.after(0, root.deiconify)
    root.mainloop()