Ejemplo n.º 1
0
 def check(self):
     must_upgrade = False
     try:
         lct_glob = LucteriosGlobal()
         _, must_upgrade = lct_glob.check()
     finally:
         self.after(300, self.set_ugrade_state, must_upgrade)
Ejemplo n.º 2
0
    def _refresh_modules(self):
        self.btnupgrade.config(state=DISABLED)
        self.module_txt.config(state=NORMAL)
        self.module_txt.delete("1.0", END)
        lct_glob = LucteriosGlobal()
        mod_lucterios, mod_applis, mod_modules = lct_glob.installed()
        self.module_txt.insert(
            END, ugettext("Lucterios core\t\t%s\n") % mod_lucterios[1])
        self.module_txt.insert(END, '\n')
        self.module_txt.insert(END, ugettext("Application\n"))
        for appli_item in mod_applis:
            self.module_txt.insert(
                END, "\t%s\t%s\n" % (appli_item[0].ljust(30), appli_item[1]))
        self.module_txt.insert(END, ugettext("Modules\n"))
        for module_item in mod_modules:
            self.module_txt.insert(
                END, "\t%s\t%s\n" % (module_item[0].ljust(30), module_item[1]))
        extra_urls = lct_glob.get_extra_urls()
        if len(extra_urls) > 0:
            self.module_txt.insert(END, "\n")
            self.module_txt.insert(END, ugettext("Pypi servers\n"))
            for extra_url in extra_urls:
                self.module_txt.insert(END, "\t%s\n" % extra_url)
        self.module_txt.config(state=DISABLED)
        self.has_checked = True

        self.after(1000, lambda: Thread(target=self.check).start())
Ejemplo n.º 3
0
 def check(self):
     must_upgrade = False
     try:
         lct_glob = LucteriosGlobal()
         _, must_upgrade = lct_glob.check()
     finally:
         self.after(300, self.set_ugrade_state, must_upgrade)
Ejemplo n.º 4
0
    def _refresh_modules(self):
        self.btnupgrade.config(state=DISABLED)
        self.module_txt.config(state=NORMAL)
        self.module_txt.delete("1.0", END)
        lct_glob = LucteriosGlobal()
        mod_lucterios, mod_applis, mod_modules = lct_glob.installed()
        self.module_txt.insert(
            END,
            ugettext("Lucterios core\t\t%s\n") % mod_lucterios[1])
        self.module_txt.insert(END, '\n')
        self.module_txt.insert(END, ugettext("Application\n"))
        for appli_item in mod_applis:
            self.module_txt.insert(
                END, "\t%s\t%s\n" % (appli_item[0].ljust(30), appli_item[1]))
        self.module_txt.insert(END, ugettext("Modules\n"))
        for module_item in mod_modules:
            self.module_txt.insert(
                END, "\t%s\t%s\n" % (module_item[0].ljust(30), module_item[1]))
        extra_urls = lct_glob.get_extra_urls()
        if len(extra_urls) > 0:
            self.module_txt.insert(END, "\n")
            self.module_txt.insert(END, ugettext("Pypi servers\n"))
            for extra_url in extra_urls:
                self.module_txt.insert(END, "\t%s\n" % extra_url)
        self.module_txt.config(state=DISABLED)
        self.has_checked = True

        self.run_after(1000, lambda: Thread(target=self.check).start())
Ejemplo n.º 5
0
    def _refresh_instance_list(self):
        self.instance_list.delete(0, END)
        luct_glo = LucteriosGlobal()
        instance_list = luct_glo.listing()
        for item in instance_list:
            self.instance_list.insert(END, item)
            if item not in self.running_instance.keys():
                self.running_instance[item] = None

        instance_names = list(self.running_instance.keys())
        for old_item in instance_names:
            if old_item not in instance_list:
                if self.running_instance[old_item] is not None:
                    self.running_instance[old_item].stop()
                del self.running_instance[old_item]
Ejemplo n.º 6
0
    def _refresh_instance_list(self):
        self.instance_list.delete(0, END)
        luct_glo = LucteriosGlobal()
        instance_list = luct_glo.listing()
        for item in instance_list:
            self.instance_list.insert(END, item)
            if item not in self.running_instance.keys():
                self.running_instance[item] = None

        instance_names = list(self.running_instance.keys())
        for old_item in instance_names:
            if old_item not in instance_list:
                if self.running_instance[old_item] is not None:
                    self.running_instance[old_item].stop()
                del self.running_instance[old_item]
Ejemplo n.º 7
0
 def appli_selection(self, event):
     if self.applis.get() != '':
         appli_id = list(self.applis[VALUES]).index(self.applis.get())
         luct_glo = LucteriosGlobal()
         current_inst_names = luct_glo.listing()
         appli_root_name = self.mod_applis[appli_id][0].split('.')[-1]
         default_name_idx = 1
         while appli_root_name + six.text_type(default_name_idx) in current_inst_names:
             default_name_idx += 1
         self.name.delete(0, END)
         self.name.insert(
             0, appli_root_name + six.text_type(default_name_idx))
         mod_depended = self.mod_applis[appli_id][2]
         self.modules.select_clear(0, self.modules.size())
         for mod_idx in range(len(self.module_data)):
             current_mod = self.module_data[mod_idx]
             if current_mod in mod_depended:
                 self.modules.selection_set(mod_idx)
Ejemplo n.º 8
0
 def setUp(self):
     self.path_dir = join(dirname(dirname(dirname(__file__))), "test")
     rmtree(self.path_dir, True)
     makedirs(self.path_dir)
     self.luct_glo = LucteriosGlobal(self.path_dir)
     self.waiting_table = ['CORE_label', 'CORE_parameter', 'CORE_printmodel', 'CORE_savedcriteria', 'auth_group', 'auth_group_permissions',
                           'auth_permission', 'auth_user', 'auth_user_groups', 'auth_user_user_permissions',
                           'django_admin_log', 'django_content_type', 'django_migrations', 'django_session']
     self.waiting_table.sort()
Ejemplo n.º 9
0
 def appli_selection(self, event):
     if self.applis.get() != '':
         appli_id = list(self.applis[VALUES]).index(self.applis.get())
         luct_glo = LucteriosGlobal()
         current_inst_names = luct_glo.listing()
         appli_root_name = self.mod_applis[appli_id][0].split('.')[-1]
         default_name_idx = 1
         while appli_root_name + six.text_type(default_name_idx) in current_inst_names:
             default_name_idx += 1
         self.name.delete(0, END)
         self.name.insert(
             0, appli_root_name + six.text_type(default_name_idx))
         mod_depended = self.mod_applis[appli_id][2]
         self.modules.select_clear(0, self.modules.size())
         for mod_idx in range(len(self.module_data)):
             current_mod = self.module_data[mod_idx]
             if current_mod in mod_depended:
                 self.modules.selection_set(mod_idx)
Ejemplo n.º 10
0
 def execute(self, instance_name=None):
     from lucterios.framework.settings import DEFAULT_LANGUAGES, get_locale_lang
     values = [
         six.text_type(ugettext_lazy("CORE-connectmode.0")),
         six.text_type(ugettext_lazy("CORE-connectmode.1")),
         six.text_type(ugettext_lazy("CORE-connectmode.2"))
     ]
     self.mode[VALUES] = values
     self.language[VALUES] = [lang[1] for lang in DEFAULT_LANGUAGES]
     self.typedb[VALUES] = ["SQLite", "MySQL", "PostgreSQL"]
     lct_glob = LucteriosGlobal()
     _, self.mod_applis, mod_modules = lct_glob.installed()
     self.mod_applis.sort(key=lambda item: get_module_title(item[0]))
     self.modules.delete(0, END)
     self.module_data = []
     module_list = []
     for mod_module_item in mod_modules:
         module_list.append(
             (get_module_title(mod_module_item[0]), mod_module_item[0]))
     module_list.sort(key=lambda module: module[0])
     for module_title, module_name in module_list:
         self.modules.insert(END, module_title)
         self.module_data.append(module_name)
     appli_list = []
     for mod_appli_item in self.mod_applis:
         appli_list.append(get_module_title(mod_appli_item[0]))
     self.applis[VALUES] = appli_list
     if instance_name is not None:
         self._load_current_data(instance_name)
     else:
         self.typedb.current(0)
         self.mode.current(2)
         if len(appli_list) > 0:
             self.applis.current(0)
         self.appli_selection(None)
         self.mode_selection(None)
         self.typedb_selection(None)
         for lang in DEFAULT_LANGUAGES:
             if lang[0] == get_locale_lang():
                 self.language.current(self.language[VALUES].index(lang[1]))
     center(self)
Ejemplo n.º 11
0
 def _define_values(self):
     from lucterios.framework.settings import DEFAULT_LANGUAGES
     self.mode_values = [
         six.text_type(ugettext("CORE-connectmode.0")),
         six.text_type(ugettext("CORE-connectmode.1")),
         six.text_type(ugettext("CORE-connectmode.2"))
     ]
     self.lang_values = [lang[1] for lang in DEFAULT_LANGUAGES]
     self.dbtype_values = ["SQLite", "MySQL", "PostgreSQL"]
     lct_glob = LucteriosGlobal()
     _, self.mod_applis, mod_modules = lct_glob.installed()
     self.current_inst_names = lct_glob.listing()
     self.mod_applis.sort(key=lambda item: get_module_title(item[0]))
     self.module_list = []
     for mod_module_item in mod_modules:
         self.module_list.append(
             (get_module_title(mod_module_item[0]), mod_module_item[0]))
     self.module_list.sort(key=lambda module: module[0])
     self.appli_list = []
     for mod_appli_item in self.mod_applis:
         self.appli_list.append(get_module_title(mod_appli_item[0]))
Ejemplo n.º 12
0
 def execute(self, instance_name=None):
     from lucterios.framework.settings import DEFAULT_LANGUAGES, get_locale_lang
     self.mode[VALUES] = [ugettext(
         "CORE-connectmode.0"), ugettext("CORE-connectmode.1"), ugettext("CORE-connectmode.2")]
     self.language[VALUES] = [lang[1] for lang in DEFAULT_LANGUAGES]
     self.typedb[VALUES] = ["SQLite", "MySQL", "PostgreSQL"]
     lct_glob = LucteriosGlobal()
     _, self.mod_applis, mod_modules = lct_glob.installed()
     self.mod_applis.sort(key=lambda item: get_module_title(item[0]))
     self.modules.delete(0, END)
     self.module_data = []
     module_list = []
     for mod_module_item in mod_modules:
         module_list.append(
             (get_module_title(mod_module_item[0]), mod_module_item[0]))
     module_list.sort(key=lambda module: module[0])
     for module_title, module_name in module_list:
         self.modules.insert(END, module_title)
         self.module_data.append(module_name)
     appli_list = []
     for mod_appli_item in self.mod_applis:
         appli_list.append(get_module_title(mod_appli_item[0]))
     self.applis[VALUES] = appli_list
     if instance_name is not None:
         self._load_current_data(instance_name)
     else:
         self.typedb.current(0)
         self.mode.current(2)
         if len(appli_list) > 0:
             self.applis.current(0)
         self.appli_selection(None)
         self.mode_selection(None)
         self.typedb_selection(None)
         for lang in DEFAULT_LANGUAGES:
             if lang[0] == get_locale_lang():
                 self.language.current(self.language[VALUES].index(lang[1]))
     center(self)
Ejemplo n.º 13
0
def LucteriosRefreshAll():
    try:
        luct_glo = LucteriosGlobal()
        luct_glo.refreshall()
    except Exception:
        logging.getLogger(__name__).exception("refreshall")
Ejemplo n.º 14
0
def LucteriosRefreshAll():
    try:
        luct_glo = LucteriosGlobal()
        luct_glo.refreshall()
    except Exception:
        logging.getLogger(__name__).exception("refreshall")