Example #1
0
    def __init__(self):
        super(gpvdm_main_window, self).__init__()
        icon_init_db()
        #from scans_io import scans_io
        #from cal_path import get_sim_path
        #scans=scans_io(get_sim_path())
        #sims=scans.get_scan_dirs()
        #print(sims)
        #asdsa
        self.splash = splash_window()
        self.scan_human_labels = get_scan_human_labels()

        self.splash.inc_value()
        process_events()
        process_events()

        #from wiz import wiz
        #a=wiz()
        #a.exec_()

        #sys.exit()
        do_import()

        if os.path.isdir(os.path.dirname(sys.argv[0])) == False:
            error_dlg(self, _("I can't run from inside a zip file!"))
            sys.exit()

        self.splash.inc_value()
        self.splash.inc_value()

        server_init()
        self.splash.inc_value()

        self.check_sim_exists = check_sim_exists()
        self.splash.inc_value()

        self.check_sim_exists.start_thread()
        self.splash.inc_value()

        self.check_sim_exists.sim_gone.connect(self.sim_gone)
        self.splash.inc_value()

        self.my_server = server_get()
        self.my_server.init(get_sim_path())
        self.splash.inc_value()

        self.undo_list = undo_list_class()
        wpos_load()
        self.splash.inc_value()

        self.ribbon = ribbon()
        self.splash.inc_value()

        self.notebook_active_page = None
        self.setAcceptDrops(True)
        #self.setGeometry(200, 100, 1300, 600)
        self.setWindowTitle(
            "General-purpose Photovoltaic Device Model (https://www.gpvdm.com)"
        )

        self.l = lock_gui()

        #self.l.disable_all.connect(self.disable_interface)
        #self.l.enable_all.connect(self.enable_disable_buttons)

        #super(gpvdm_main_window, self).__init__(parent, QtCore.Qt.FramelessWindowHint)
        #gobject.GObject.__init__(self)

        #self.my_server.setup_gui(self.gui_sim_start)
        self.my_server.sim_started.connect(self.gui_sim_start)
        self.splash.inc_value()

        self.my_server.sim_finished.connect(self.gui_sim_stop)
        self.splash.inc_value()

        help_init()
        self.splash.inc_value()

        #help_window().help_set_help(["star.png",_("<big><b>Update available!</b></big><br>")])

        #self.show()

        if running_on_linux() == True:
            self.bus = dbus.SessionBus()
            self.bus.add_match_string_non_blocking(
                "type='signal',interface='org.my.gpvdm'")
            self.bus.add_message_filter(self.adbus)
        else:
            self.win_pipe = win_pipe()
            self.win_pipe.new_data.connect(self.win_dbus)
            self.win_pipe.start()

        self.notebook = gpvdm_notebook()
        vbox = QVBoxLayout()
        self.splash.inc_value()

        vbox.addWidget(self.ribbon)
        self.ribbon.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.notebook.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Expanding)
        vbox.addWidget(self.notebook)
        wvbox = QWidget()
        self.splash.inc_value()

        wvbox.setLayout(vbox)
        self.setCentralWidget(wvbox)

        self.splash.inc_value()

        self.statusBar()

        temp_error = ver_error()
        #print(temp_error)
        if len(temp_error) > 0:
            error_dlg(self, temp_error)
            return

        self.setWindowIcon(
            QIcon(os.path.join(get_image_file_path(), "image.jpg")))
        self.splash.inc_value()

        self.show_tabs = True
        self.show_border = True

        self.ribbon.file.home_new.clicked.connect(self.callback_new)
        self.ribbon.file.home_open.clicked.connect(self.callback_open)
        self.ribbon.file.used_files_click.connect(self.load_sim)
        self.ribbon.home.undo.triggered.connect(self.callback_undo)
        self.ribbon.home.run.start_sim.connect(self.callback_simulate)
        self.splash.inc_value()

        #self.ribbon.home.stop.setEnabled(False)

        self.ribbon.home.scan.setEnabled(False)
        self.ribbon.thermal.setEnabled(False)

        self.ribbon.home.help.triggered.connect(self.callback_on_line_help)

        update_init()

        resize_window_to_be_sane(self, 0.7, 0.75)

        self.change_dir_and_refresh_interface(get_sim_path())
        self.splash.inc_value()

        #self.ribbon.home.sun.changed.connect(self.notebook.update)
        self.ribbon.setAutoFillBackground(True)
        self.splash.inc_value()
        self.show()

        help_window().show()

        self.enable_disable_buttons()

        val = inp_get_token_value(os.path.join(get_sim_path(), "config.inp"),
                                  "#use_gpvdm_local")
        if val != "false":
            if os.path.isdir(get_materials_path()) == False:
                clone_materials(get_materials_path(), get_base_material_path(),
                                "material")

            if os.path.isdir(get_emission_path()) == False:
                clone_materials(get_emission_path(), get_base_emission_path(),
                                "emission")

            if os.path.isdir(get_shape_path()) == False:
                clone_materials(get_shape_path(), get_base_shape_path(),
                                "shape")

            if os.path.isdir(get_scripts_path()) == False:
                shutil.copytree(get_base_scripts_path(),
                                get_scripts_path(),
                                symlinks=True)

            if os.path.isdir(get_spectra_path()) == False:
                clone_spectras(get_spectra_path())

        self.cache = cache(only_open_if_full=True)

        #from shape_editor import shape_editor
        #self.shape_window=shape_editor("/home/rod/gpvdm_local/shape/pedot")
        #self.shape_window.show()

        #from shape_import import shape_import
        #self.shape_import=shape_import("/home/rod/gpvdm_local/shape/pedot")
        #self.shape_import.show()
        check_lib_in_bash_rc()
Example #2
0
    def __init__(self):
        super(gpvdm_main_window, self).__init__()

        self.splash = splash_window()
        self.splash.inc_value()
        process_events()
        process_events()

        #from wiz import wiz
        #a=wiz()
        #a.exec_()

        #sys.exit()
        do_import()

        if os.path.isdir(os.path.dirname(sys.argv[0])) == False:
            error_dlg(self, _("I can't run from inside a zip file!"))
            sys.exit()

        self.splash.inc_value()
        self.splash.inc_value()

        server_init()
        self.splash.inc_value()

        self.check_sim_exists = check_sim_exists()
        self.splash.inc_value()

        self.check_sim_exists.start_thread()
        self.splash.inc_value()

        self.check_sim_exists.sim_gone.connect(self.sim_gone)
        self.splash.inc_value()

        self.my_server = server_get()
        self.my_server.init(get_sim_path())
        self.splash.inc_value()

        self.undo_list = undo_list_class()
        wpos_load()
        self.splash.inc_value()

        self.ribbon = ribbon()
        self.splash.inc_value()

        self.notebook_active_page = None
        self.setAcceptDrops(True)
        #self.setGeometry(200, 100, 1300, 600)
        self.setWindowTitle(
            "General-purpose Photovoltaic Device Model (https://www.gpvdm.com)"
        )

        #super(gpvdm_main_window, self).__init__(parent, QtCore.Qt.FramelessWindowHint)
        #gobject.GObject.__init__(self)

        self.my_server.setup_gui(self.gui_sim_start)
        self.splash.inc_value()

        self.my_server.sim_finished.connect(self.gui_sim_stop)
        self.splash.inc_value()

        help_init()
        self.splash.inc_value()

        #help_window().help_set_help(["star.png",_("<big><b>Update available!</b></big><br>")])

        #self.show()

        if running_on_linux() == True:
            DBusQtMainLoop(set_as_default=True)
            self.bus = dbus.SessionBus()
            self.bus.add_match_string_non_blocking(
                "type='signal',interface='org.my.gpvdm'")
            self.bus.add_message_filter(self.adbus)
        else:
            self.win_pipe = win_pipe()
            self.win_pipe.new_data.connect(self.win_dbus)
            self.win_pipe.start()

        self.notebook = gpvdm_notebook()
        vbox = QVBoxLayout()
        self.splash.inc_value()

        vbox.addWidget(self.ribbon)
        vbox.addWidget(self.notebook)
        wvbox = QWidget()
        self.splash.inc_value()

        wvbox.setLayout(vbox)
        self.setCentralWidget(wvbox)

        self.splash.inc_value()

        self.statusBar()

        temp_error = ver_error()
        #print(temp_error)
        if len(temp_error) > 0:
            error_dlg(self, temp_error)
            return

        self.setWindowIcon(
            QIcon(os.path.join(get_image_file_path(), "image.jpg")))
        self.splash.inc_value()

        self.show_tabs = True
        self.show_border = True

        self.ribbon.home_export.triggered.connect(self.callback_export)

        #if enable_webupdates()==False:
        #	self.help_menu_update=help_menu.addAction("&"+_("Check for updates"))
        #	self.help_menu_update.triggered.connect(self.callback_update)

        self.ribbon.home_new.triggered.connect(self.callback_new)
        self.ribbon.home_open.triggered.connect(self.callback_open)
        self.ribbon.home.undo.triggered.connect(self.callback_undo)
        self.ribbon.home.run.triggered.connect(self.callback_simulate)
        self.splash.inc_value()

        self.ribbon.home.stop.setEnabled(False)

        self.ribbon.home.scan.setEnabled(False)

        self.ribbon.home.help.triggered.connect(self.callback_on_line_help)

        resize_window_to_be_sane(self, 0.7, 0.75)

        self.change_dir_and_refresh_interface(get_sim_path())
        self.splash.inc_value()

        self.ribbon.home.sun.changed.connect(self.notebook.update)
        self.ribbon.setAutoFillBackground(True)
        self.splash.inc_value()
        self.show()
        help_window().show()

        from update import update_window
        self.a = update_window()
        self.a.show()