def __init__(self, application, source_store, target_store, auto_sync, verbose): QtCore.QObject.__init__(self) self.LOG_LEVEL = logging.INFO if verbose: self.LOG_LEVEL = logging.DEBUG self.__log = LogHelper.get_app_logger(self.LOG_LEVEL) ## create a config object to get the registered store paths self.__main_config = ConfigWrapper(TsConstants.CONFIG_PATH) ## create the object self.__sync_widget = SyncController(application, source_store, target_store, auto_sync, verbose_mode) ## connect to the signal(s) self.connect(self.__sync_widget, QtCore.SIGNAL("sync_cancel"), self.__handle_sync_cancel) self.connect(self.__sync_widget, QtCore.SIGNAL("sync_error"), self.__handle_sync_error) self.connect(self.__sync_widget, QtCore.SIGNAL("sync_success"), self.__handle_sync_success) ## start the sync controller self.__sync_widget.start()
def __init__(self, application, path, retag_mode, verbose): QtCore.QObject.__init__(self) self.LOG_LEVEL = logging.INFO if verbose: self.LOG_LEVEL = logging.DEBUG self.__log = LogHelper.get_app_logger(self.LOG_LEVEL) ## create a config object to get the registered store paths self.__main_config = ConfigWrapper(TsConstants.CONFIG_PATH) if self.__main_config is None: self.__log.info("No config file found for the given path") self.__handle_retag_error() else: self.__store_path = PathHelper.resolve_store_path(path, self.__main_config.get_store_path_list()) self.__item_name = PathHelper.get_item_name_from_path(path) ## create the object self.__retag_widget = ReTagController(application, self.__store_path, self.__item_name, True, verbose_mode) ## connect to the signal(s) self.connect(self.__retag_widget, QtCore.SIGNAL("retag_cancel"), self.__handle_retag_cancel) self.connect(self.__retag_widget, QtCore.SIGNAL("retag_error"), self.__handle_retag_error) self.connect(self.__retag_widget, QtCore.SIGNAL("retag_success"), self.__handle_retag_success) ## start the retagging self.__retag_widget.start()
def __init_configuration(self): """ initializes the configuration. This method is called every time the config file changes """ self.__log.info("initialize configuration") if self.__main_config is None: self.__main_config = ConfigWrapper(TsConstants.CONFIG_PATH) #self.connect(self.__main_config, QtCore.SIGNAL("changed()"), self.__init_configuration) self.CURRENT_LANGUAGE = self.__main_config.get_current_language() if self.CURRENT_LANGUAGE is None or self.CURRENT_LANGUAGE == "": self.CURRENT_LANGUAGE = self.__get_locale_language() # switch back to the configured language self.change_language(self.CURRENT_LANGUAGE) ## connect to all the signals the admin gui is sending if self.__admin_dialog is None: self.__admin_dialog = StorePreferencesController() self.connect(self.__admin_dialog, QtCore.SIGNAL("create_new_store"), self.__handle_new_store) self.connect(self.__admin_dialog, QtCore.SIGNAL("rename_desc_tag"), self.__handle_tag_rename) self.connect(self.__admin_dialog, QtCore.SIGNAL("rename_cat_tag"), self.__handle_tag_rename) self.connect(self.__admin_dialog, QtCore.SIGNAL("retag"), self.__handle_retagging) self.connect(self.__admin_dialog, QtCore.SIGNAL("rebuild_store"), self.__handle_store_rebuild) self.connect(self.__admin_dialog, QtCore.SIGNAL("rename_store"), self.__handle_store_rename) self.connect(self.__admin_dialog, QtCore.SIGNAL("delete_store"), self.__handle_store_delete) self.connect(self.__admin_dialog, QtCore.SIGNAL("synchronize"), self.__handle_synchronization) self.__admin_dialog.set_main_config(self.__main_config) self.__prepare_store_params() self.__create_stores() ## create a temporary store list ## add the desc and cat tags which are needed in the admin-dialog tmp_store_list = [] for current_store_item in self.__main_config.get_stores(): store_name = current_store_item["path"].split("/").pop() current_store_item["desc_tags"] = self.__store_dict[ store_name].get_tags() current_store_item["cat_tags"] = self.__store_dict[ store_name].get_categorizing_tags() tmp_store_list.append(current_store_item) self.__admin_dialog.set_store_list(tmp_store_list) if self.__main_config.get_first_start(): self.__admin_dialog.set_first_start(True)
def remove_dir(self, store_path, store_id): filesystem = FileSystemWrapper() filesystem.delete_dir(store_path) config = ConfigWrapper("../tsresources/conf/tagstore.cfg") config.remove_store(store_id) assert (not filesystem.is_directory(store_path))
def move_store(self, store_path, store_id, new_store_path): store = self.create_new_store_object(store_path, "storage") store.move(new_store_path) ## rewrite the config with the new store dir config = ConfigWrapper("../tsresources/conf/tagstore.cfg") config.rename_store(store_id, new_store_path) filesystem = FileSystemWrapper() assert (filesystem.is_directory(new_store_path))
def test_remove_store(self): """ create a store create an item with tags in the store place a "not allowed" item in the navigation hierarchy call the "remove" method of the store check if everything has been removed properly """ STORE_PATH = "./test_store/" STORAGE_DIR = "storage" NEW_ITEM_NAME = "test_item" store = self.create_new_store_object(STORE_PATH, STORAGE_DIR) filesystem = FileSystemWrapper() ## place a new item in the store file_path = "%s%s/%s" % (STORE_PATH, STORAGE_DIR, NEW_ITEM_NAME) filesystem.create_file(file_path) config = ConfigWrapper("../tsresources/conf/tagstore.cfg") ## write the new store also to the config store_id = config.add_new_store(STORE_PATH) ## now tag it manually store.add_item_with_tags(NEW_ITEM_NAME, ["should", "not"], ["get", "this"]) ## create a new file in a tag-dir to test if it is removed as well file_path = "%s%s/%s" % (STORE_PATH, "descriptions/should", "i_should_not_be_here.file") filesystem.create_file(file_path) ## now remove the store store.remove() ##check if this is done properly ##this one should not exist ... assert (not filesystem.path_exists(file_path)) ## this path should still exist assert (filesystem.path_exists(STORE_PATH)) self.remove_dir(STORE_PATH, store_id) assert (not filesystem.path_exists(STORE_PATH)) config.remove_store(store_id)
def __create_target_store(self, target_store): """ create the target store object """ # construct target store config object self.__target_store_config = ConfigWrapper(target_store) if self.__target_store_config is None: self.__emit_not_syncable( self.trUtf8("No target store found for the given path")) return # construct target store object self.__target_store = Store( self.__target_store_config.get_store_id(), target_store, self.STORE_CONFIG_DIR + "/" + self.STORE_CONFIG_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_TAGS_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_VOCABULARY_FILE_NAME, self.STORE_NAVIGATION_DIRS, self.STORE_STORAGE_DIRS, self.STORE_DESCRIBING_NAV_DIRS, self.STORE_CATEGORIZING_NAV_DIRS, self.STORE_EXPIRED_DIRS, self.__main_config.get_expiry_prefix()) self.__target_store.init()
def test_create_store_move_and_delete_dir(self): """ 1. create a new store 2. store a new item in the store - manually 3. move the store to a new location 4. delete the whole directory """ filesystem = FileSystemWrapper() NEW_ITEM_NAME = "test_item" STORE_PATH = "./test_store/" STORAGE_DIR = "storage" store = self.create_new_store_object(STORE_PATH, STORAGE_DIR) ## place a new item in the store file_path = "%s%s/%s" % (STORE_PATH, STORAGE_DIR, NEW_ITEM_NAME) filesystem.create_file(file_path) config = ConfigWrapper("../tsresources/conf/tagstore.cfg") ## write the new store also to the config store_id = config.add_new_store(STORE_PATH) ## now tag it manually store.add_item_with_tags(NEW_ITEM_NAME, ["should", "not"], ["get", "this"]) ## now the tag "should" must be a folde in the describing dir # path_to_check = "%sdescribing/should" % STORE_PATH path_to_check = "%sdescriptions/should" % STORE_PATH print path_to_check assert (filesystem.is_directory(path_to_check)) self.move_store("./test_store/", store_id, "./new_test_store/") self.remove_dir("./new_test_store/", store_id)
def __init_configuration(self): """ initializes the configuration. This method is called every time the config file changes """ self.__log.info("initialize configuration") self.__main_config = ConfigWrapper(TsConstants.CONFIG_PATH) if self.__main_config is None: self.__emit_not_retagable(self.trUtf8("No config file found for the given path")) return ## check if there has been found an appropriate store_path in the config if self.__store_path is None: self.__emit_not_retagable(self.trUtf8("No store found for the given path")) return else: self.__store_config = ConfigWrapper(self.__store_path) self.__prepare_store_params() self.CURRENT_LANGUAGE = self.__main_config.get_current_language(); self.change_language(self.CURRENT_LANGUAGE) #self.__main_config.connect(self.__main_config, QtCore.SIGNAL("changed()"), self.__init_configuration) self.__store = Store(self.__store_config.get_store_id(), self.__store_path, self.STORE_CONFIG_DIR + "/" + self.STORE_CONFIG_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_TAGS_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_VOCABULARY_FILE_NAME, self.STORE_NAVIGATION_DIRS, self.STORE_STORAGE_DIRS, self.STORE_DESCRIBING_NAV_DIRS, self.STORE_CATEGORIZING_NAV_DIRS, self.STORE_EXPIRED_DIRS, self.__main_config.get_expiry_prefix()) self.__store.init() if self.__tag_dialog is None: self.__tag_dialog = TagDialogController(self.__store.get_name(), self.__store.get_id(), self.__main_config.get_max_tags(), self.__main_config.get_tag_seperator(), self.__main_config.get_expiry_prefix()) self.__tag_dialog.get_view().setModal(True) #self.__tag_dialog.set_parent(self.sender().get_view()) self.__tag_dialog.connect(self.__tag_dialog, QtCore.SIGNAL("tag_item"), self.__tag_item_action) self.__tag_dialog.connect(self.__tag_dialog, QtCore.SIGNAL("handle_cancel()"), self.__handle_tag_cancel) ## configure the tag dialog with the according settings format_setting = self.__store.get_datestamp_format() datestamp_hidden = self.__store.get_datestamp_hidden() ## check if auto datestamp is enabled if format_setting != EDateStampFormat.DISABLED: self.__tag_dialog.show_datestamp(True) ## set the format format = None if format_setting == EDateStampFormat.DAY: format = TsConstants.DATESTAMP_FORMAT_DAY elif format_setting == EDateStampFormat.MONTH: format = TsConstants.DATESTAMP_FORMAT_MONTH self.__tag_dialog.set_datestamp_format(format, datestamp_hidden) self.__tag_dialog.show_category_line(self.__store.get_show_category_line()) self.__tag_dialog.set_category_mandatory(self.__store.get_category_mandatory()) ## check if the given item really exists in the store if not self.__store.item_exists(self.__item_name): self.__emit_not_retagable(self.trUtf8("%s: There is no such item recorded in the store" % self.__item_name)) return self.__set_tag_information_to_dialog(self.__store) if self.__retag_mode: self.__handle_retag_mode() self.__tag_dialog.show_dialog()
def test_configreader(self): config = ConfigWrapper("../tsresources/conf/tagstore.cfg") extensions = config.get_ignored_extension() assert (extensions == TsRestrictions.IGNORED_EXTENSIONS)
def __init__(self, tab, parent=None): ''' Constructor ''' QtGui.QDialog.__init__(self, parent) self.__tab = tab self.setWindowFlags(QtCore.Qt.WindowTitleHint) self.__config_wrapper = ConfigWrapper(TsConstants.CONFIG_PATH) self.__wizard = Wizard() self.setWindowTitle("tagstore Manager Help") self.setWindowIcon(QtGui.QIcon('./tsresources/images/help.png')) self.setWindowModality(QtCore.Qt.WindowModal) self.__base_layout = QtGui.QVBoxLayout() self.__descr_layout = QtGui.QHBoxLayout() self.__bb_layout = QtGui.QHBoxLayout() self.setLayout(self.__base_layout) self.__description_label = QtGui.QLabel() self.__description_label.setTextInteractionFlags( QtCore.Qt.TextSelectableByMouse) self.__cancel_button = QtGui.QPushButton(self.trUtf8("Close")) self.__wizard_button = QtGui.QPushButton(self.trUtf8("Show Wizard")) self.__visible_checkbox = QtGui.QCheckBox( self.trUtf8("Show this automatically")) self.__descr_layout.addWidget(self.__description_label) self.__visible_checkbox.setChecked(True) if self.__tab == "tagdialog": self.__description_label.setText( self.trUtf8( "In diesem Fenster werden die Items, die sich in der Ablage befinden getaggt. <br>" "Auf der rechten Seite Oben befindet sich eine Liste der noch nicht getagten Items. Um ein solches zu taggen wird zuerst eines ausgewaehlt, danach werden die Tags in die darunterliegende/n \"Tag-Zeile/n\" (je nach Einstellung) geschrieben und jeweils mit einem \",\" getrennt.<br>" "Mit einem abschliessenden Klick auf \"Tag\" wird das ausgewaehlte Item getaggt.<br>" "Auf der linken Seite befindet sich eine sogenannte \"TagCloud\" (fuer jede \"Tag-Zeile\" eine) in der sich Vorschlaege fuer Tags befinden, wobei die Groesse des Tags angibt, wie oft dieser verwendet wurde (je groesser desto haeufiger).<br>" "Die in Orange dargestellten Tags wurden mit Hilfe eines Algorithmus, speziell fuer das ausgewaehlte Item und ihren Taggingverhalten ausgesucht." )) self.__tagging_label = QtGui.QLabel() self.__tagging_label.setPixmap( QtGui.QPixmap( self.trUtf8("./tsresources/images/tagging_en.png"))) self.__descr_layout.addWidget(self.__tagging_label) self.setWindowTitle(self.trUtf8("Help tag-dialog")) if not self.__config_wrapper.get_show_tag_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "My Tags": self.__description_label.setText( self.trUtf8( "Unter dem Reiter \"Meine Tags\" kann fuer jeden Store nachgeschaut werden, ob eine oder zwei Tag-Zeilen verwendet werden. In der erste Tag-Zeile werden beschreibende und in der zweiten kategorisierende Tags verwendet.<br>" "Wird nur eine Zeile verwendet, kann eingestellt werden, ob in dieser nur vom Benutzter vordefinierte Tags (\"Meine Tags\") erlaubt werden oder nicht. Dies soll die Verwendung von aehnlichen Tags verhindern(z.B: Uni, Universitaet). <br>" "Solche Tags koennen mit einem klick auf \"Hinzufuegen\" der Liste von Tags hinzugefuegt werden oder mit \"Loeschen\" von ihr geloescht werden. <br>" "Werden zwei Zeilen verwendet, kann nur noch fuer die zweite Tag-Zeile eingestellt werden, ob diese nur \"meine Tags\" verwenden soll." )) if not self.__config_wrapper.get_show_my_tags_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Datestamps": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter kann eingestellt werden, ob beim taggen, das Datum automatisch in die \"Tagline\" eingetragen wird." )) if not self.__config_wrapper.get_show_datestamps_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Expiry Date": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter kann eingestellt werden, wann ein bestimmtes Objekt, mit Hilfe eines Praefixes, ablaeuft und in den Ordner \"abgelaufene_Daten\" verschoben wird.<br>" "Diesr Praefix kann in der Zeile am unteren Ende des Tabs definiert werden." )) if not self.__config_wrapper.get_show_expiry_date_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Re-Tagging": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter koennen bereits getaggte Objekte neu getaggt werden. Dazu wird ein Objekt ausgewaehlt und anschliessend auf \"Re-Tag\" geklickt." )) if not self.__config_wrapper.get_show_retagging_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Rename Tags": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter koennen Tags, die zum taggen verwendet wurden, umbenannt werden, womit sich auch die Ordnerstruktur aendert.<br>" "Dazu wird ein Tag ausgewaehlt und anschliessend auf \"Umbenennen\" geklickt." )) if not self.__config_wrapper.get_show_rename_tags_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Store Management": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter kann ein neuer \"Store\" angelegt oder ein bereits vorhandener geloescht oder umbenannet werden. Dies geschiet durch einen Klick auf \"Neuer tagstore\", \"Loeschen ...\" oder \"Umbenennen ...\".<br>" "Zum loeschen oder umbenennen muss der gewuenschte \"Store\" ausgewaehlt werden.<br>" "Wenn erwuenscht, kann auch die Ordnerstruktur des ausgewaehlten \"Stores\", mit einem klick auf \"Struktur neu erstellen ...\" neu erstellt werden" )) if not self.__config_wrapper.get_show_store_management_help(): self.__visible_checkbox.setChecked(False) elif self.__tab == "Sync Settings": self.__description_label.setText( self.trUtf8( "Unter diesem Reiter kann ein Tag zum synchronisieren mit Android definiert werden. Alle Items, welche mit diesem Tag getaggt werden, werden automatisch synchronisiert." )) if not self.__config_wrapper.get_show_sync_settings_help(): self.__visible_checkbox.setChecked(False) self.__description_label.setWordWrap(True) self.__bb_layout.addWidget(self.__visible_checkbox) self.__bb_layout.addWidget(self.__wizard_button) self.__bb_layout.addWidget(self.__cancel_button) self.__base_layout.addLayout(self.__descr_layout) self.__base_layout.addLayout(self.__bb_layout) self.__visible_checkbox.stateChanged.connect(self.__handle_checkbox) self.connect(self.__cancel_button, QtCore.SIGNAL('clicked()'), self.__handle_close) self.connect(self.__wizard_button, QtCore.SIGNAL('clicked()'), self.__handle_show_wizard)
def __init_configurations(self): """ initializes the configuration. This method is called every time the config file changes """ self.__log.info("initialize configuration") ## reload config file - overwrite default settings self.__app_config_wrapper = ConfigWrapper(TsConstants.CONFIG_PATH) self.__app_config_wrapper.connect(self.__app_config_wrapper, QtCore.SIGNAL("changed()"), self.__init_configurations) self.__app_config_wrapper.print_app_config_to_log() tag_seperator = self.__app_config_wrapper.get_tag_seperator() if tag_seperator.strip() != "": self.TAG_SEPERATOR = tag_seperator expiry_prefix = self.__app_config_wrapper.get_expiry_prefix() if expiry_prefix.strip() != "": self.EXPIRY_PREFIX = expiry_prefix self.NUM_RECENT_TAGS = self.__app_config_wrapper.get_num_popular_tags() self.NUM_POPULAR_TAGS = self.__app_config_wrapper.get_num_popular_tags() self.MAX_TAGS = self.__app_config_wrapper.get_max_tags() self.CURRENT_LANGUAGE = self.__app_config_wrapper.get_current_language(); if self.CURRENT_LANGUAGE is None or self.CURRENT_LANGUAGE == "": self.CURRENT_LANGUAGE = self.trUtf8("en") self.change_language(self.CURRENT_LANGUAGE) config_dir = self.__app_config_wrapper.get_store_config_directory() if config_dir != "": self.STORE_CONFIG_DIR = config_dir config_file_name = self.__app_config_wrapper.get_store_configfile_name() if config_file_name != "": self.STORE_CONFIG_FILE_NAME = config_file_name tags_file_name = self.__app_config_wrapper.get_store_tagsfile_name() if tags_file_name != "": self.STORE_TAGS_FILE_NAME = tags_file_name vocabulary_file_name = self.__app_config_wrapper.get_store_vocabularyfile_name() if vocabulary_file_name != "": self.STORE_VOCABULARY_FILE_NAME = vocabulary_file_name # self.SUPPORTED_LANGUAGES = self.__app_config_wrapper.get_supported_languages() # current_language = self.CURRENT_LANGUAGE # self.STORE_STORAGE_DIRS = [] # self.STORE_NAVIGATION_DIRS = [] # for lang in self.SUPPORTED_LANGUAGES: # self.change_language(lang) # self.STORE_STORAGE_DIRS.append(self.trUtf8("storage")) # self.STORE_NAVIGATION_DIRS.append(self.trUtf8("navigation")) # ## reset language # self.change_language(current_language) ## get stores from config file config_store_items = self.__app_config_wrapper.get_stores() config_store_ids = self.__app_config_wrapper.get_store_ids() deleted_stores = [] for store in self.STORES: id = store.get_id() if id in config_store_ids: ## update changed stores store.set_path(self.__app_config_wrapper.get_store_path(id), self.STORE_CONFIG_DIR + "/" + self.STORE_CONFIG_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_TAGS_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_VOCABULARY_FILE_NAME) store.change_expiry_prefix(self.EXPIRY_PREFIX) config_store_ids.remove(id) ## remove already updated items else: ## remove deleted stores deleted_stores.append(store) ## update deleted stores from global list after iterating through it for store in deleted_stores: self.STORES.remove(store) self.__log.debug("removed store: %s", store.get_name()) ## add new stores for store_item in config_store_items: if store_item["id"] in config_store_ids: ## new store = Store(store_item["id"], store_item["path"], self.STORE_CONFIG_DIR + "/" + self.STORE_CONFIG_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_TAGS_FILE_NAME, self.STORE_CONFIG_DIR + "/" + self.STORE_VOCABULARY_FILE_NAME, self.STORE_NAVIGATION_DIRS, self.STORE_STORAGE_DIRS, self.STORE_DESCRIBING_NAV_DIRS, self.STORE_CATEGORIZING_NAV_DIRS, self.STORE_EXPIRED_DIRS, self.EXPIRY_PREFIX) store.connect(store, QtCore.SIGNAL("removed(PyQt_PyObject)"), self.store_removed) store.connect(store, QtCore.SIGNAL("renamed(PyQt_PyObject, QString)"), self.store_renamed) store.connect(store, QtCore.SIGNAL("file_renamed(PyQt_PyObject, QString, QString)"), self.file_renamed) store.connect(store, QtCore.SIGNAL("file_removed(PyQt_PyObject, QString)"), self.file_removed) store.connect(store, QtCore.SIGNAL("pending_operations_changed(PyQt_PyObject)"), self.pending_file_operations) store.connect(store, QtCore.SIGNAL("vocabulary_changed"), self.__handle_vocabulary_changed) store.connect(store, QtCore.SIGNAL("store_config_changed"), self.__handle_store_config_changed) extensions = self.__app_config_wrapper.get_additional_ignored_extension() ##if there comes a value from the config -> set it if len(extensions) > 0 and extensions[0] != "": store.add_ignored_extensions(extensions) self.STORES.append(store) self.__log.debug("init store: %s", store.get_name()) ## create a dialogcontroller for each store ... tmp_dialog = TagDialogController(store.get_name(), store.get_id(), self.MAX_TAGS, self.TAG_SEPERATOR, self.EXPIRY_PREFIX) tmp_dialog.connect(tmp_dialog, QtCore.SIGNAL("tag_item"), self.tag_item_action) tmp_dialog.connect(tmp_dialog, QtCore.SIGNAL("handle_cancel()"), self.handle_cancel) tmp_dialog.connect(tmp_dialog, QtCore.SIGNAL("open_store_admin_dialog()"), self.show_admin_dialog) self.DIALOGS[store.get_id()] = tmp_dialog ## call init to initialize new store instance (after adding the event handler) ## necessary if store was renamed during tagstore was not running (to write config) store.init() self.connect(tmp_dialog, QtCore.SIGNAL("item_selected"), self.__set_tag_information_to_dialog_wrapper) self.__configure_tag_dialog(store, tmp_dialog)
def __init_configuration(self): """ initializes the configuration """ # informal debug self.__log.info("__init_configuration") # construct config wrapper self.__main_config = ConfigWrapper(TsConstants.CONFIG_PATH) if self.__main_config is None: self.__emit_not_syncable( self.trUtf8("No config file found for the given path")) return search_source_path = False found_source_path = False if self.__source_store_path != None and self.__source_store_path != "": search_source_path = True search_target_path = False found_target_path = False if self.__target_store_path != None and self.__target_store_path != "": search_target_path = True ## create a temporary store list ## add the desc and cat tags which are needed in the admin-dialog tmp_store_list = [] store_list = self.__main_config.get_stores() # add android store # when registered android_source_path = self.__main_config.get_android_store_path() if android_source_path != None and android_source_path != "": store_item = {} store_item["path"] = android_source_path store_item["name"] = "Android" store_list.append(store_item) # enumerate all stores and add their names and paths store_name = None for current_store_item in store_list: if current_store_item.has_key("name"): store_name = current_store_item["name"] else: store_name = current_store_item["path"].split("/").pop() store_path = current_store_item["path"] current_store_item["name"] = store_name current_store_item["path"] = store_path tmp_store_list.append(current_store_item) # find source target list if search_source_path: if store_path == self.__source_store_path: found_source_path = True if search_target_path: if store_path == self.__target_store_path: found_target_path = True if search_source_path and found_source_path == False: # source store is not registered self.__emit_not_syncable( self.trUtf8("Source tagstore not registered in main config")) return if search_target_path and found_target_path == False: # source store is not registered self.__emit_not_syncable( self.trUtf8("Target tagstore not registered in main config")) return if self.__sync_dialog is None: self.__sync_dialog = SyncDialogController(tmp_store_list, self.__source_store_path, self.__target_store_path, self.__auto_sync) self.__sync_dialog.get_view().setModal(True) #self.__tag_dialog.set_parent(self.sender().get_view()) self.__sync_dialog.connect(self.__sync_dialog, QtCore.SIGNAL("sync_store"), self.__sync_store_action) self.__sync_dialog.connect(self.__sync_dialog, QtCore.SIGNAL("sync_conflict"), self.__handle_resolve_conflict) self.__sync_dialog.connect(self.__sync_dialog, QtCore.SIGNAL("handle_cancel()"), self.__handle_sync_cancel) self.__sync_dialog.show_dialog() if self.__auto_sync: self.__sync_dialog.start_auto_sync()