diff --git a/lib/controller.py b/lib/controller.py index 4cad091..db99dba 100644 --- a/lib/controller.py +++ b/lib/controller.py @@ -287,15 +287,17 @@ class Controller(Observer): elif key == 'cb_zurücksetzen': self.zuruecksetzen() elif key == 'cb_suche_asm': - # kopiere Blacklist von Server + # hole dir die in die GUI eingetragene Nummer update_database.get_blacklist(self.get_env("data")) - # hole dir den in die gui eingetragene Nummer current_asmid = self.data_from_view('asm_id') - self.set_current_asm_id(current_asmid) + if current_asmid != '': + self.set_current_asm_id(current_asmid) elif key == 'cb_ladelokal_asm': + # hole dir nur die lokalen Daten. Keine Datenbankabfrage außer Blacklist + update_database.get_blacklist(self.get_env("data")) current_asmid = self.data_from_view('asm_id') - # hole dir nur die lokalen Daten. Keine Datenbankabfrage - self.set_current_asm_id(current_asmid, load_local_bom=True, load_local_teilestamm=True, load_local_rd_ids=True) + if current_asmid != '': + self.set_current_asm_id(current_asmid, load_local_bom=True, load_local_teilestamm=True, load_local_rd_ids=True) elif key == 'cb_3dsuchen': self.suche_3d() @@ -322,6 +324,7 @@ class Controller(Observer): return # Pruefung ob assembly-id in Blacklist fehlt + update_database.get_blacklist(self.get_env("data")) (ok, missing_blacklist_id) = self._model.check_blacklist_completeness() if ok == False: id = ''.join(missing_blacklist_id) diff --git a/lib/manage_configs.py b/lib/manage_configs.py index d7d821c..e3f6051 100644 --- a/lib/manage_configs.py +++ b/lib/manage_configs.py @@ -806,7 +806,6 @@ class Configs: self.Materialien = MaterialTransConfig(cfg_dir) self.bom_config = BOMConfig(cfg_dir) self._teilenummern = None - self._blacklist = None def get_cfg_path(self): return self._cfg_dir @@ -826,8 +825,7 @@ class Configs: def get_blacklist(self): if not self._data_dir: raise Exception("set_data_dir not called. path not set") - if not self._blacklist: - with open(os.path.join(self._data_dir, 'blacklist.txt')) as f: - lines = f.read().splitlines() - self._blacklist = lines + with open(os.path.join(self._data_dir, 'blacklist.txt')) as f: + lines = f.read().splitlines() + self._blacklist = lines return self._blacklist