Do less on init, allow events to drive
authorJack Miller <jack@codezen.org>
Tue, 16 Jun 2015 00:02:07 +0000 (19:02 -0500)
committerJack Miller <jack@codezen.org>
Tue, 16 Jun 2015 00:02:07 +0000 (19:02 -0500)
canto_curses/main.py
canto_curses/tag.py
canto_curses/tagcore.py
canto_curses/taglist.py

index 99d592b..9c1f126 100644 (file)
@@ -206,13 +206,9 @@ class CantoCurses(CantoClient):
         else:
             log.info("Version check passed: %s" % CANTO_PROTOCOL_COMPATIBLE)
 
-        # Make TagCores for each tag
-        tag_updater.init(self)
-
         # Create Tags for each TagCore
         self.gui = CantoCursesGui(self, self.glog_handler)
-
-        # Generate initial traffic
+        tag_updater.init(self)
         tag_updater.update()
 
         # Initial signal setup.
index 0248cc1..420e5bc 100644 (file)
@@ -105,8 +105,6 @@ class Tag(PluginHandler, list):
 
         alltags.append(self)
 
-        self.sync(True)
-
         self.plugin_class = TagPlugin
         self.update_plugin_lookups()
 
index 143a8c5..653e6aa 100644 (file)
@@ -136,8 +136,7 @@ class TagUpdater(SubThread):
 
         self.write("WATCHTAGS", strtags)
         for tag in strtags:
-            self.prot_tagchange(tag)
-            TagCore(tag)
+            self.on_new_tag(tag)
 
         on_hook("curses_new_tag", self.on_new_tag)
         on_hook("curses_del_tag", self.on_del_tag)
index e77ecde..f815320 100644 (file)
@@ -56,22 +56,6 @@ class TagList(GuiBase):
         # Hold config log so we don't miss any new TagCores or get updates
         # before we're ready.
 
-        config_lock.acquire_write()
-
-        # Instantiate graphical Tag objects
-        # Keep in mind TagList may be instantiated more than once.
-
-        for tagcore in alltagcores:
-            for tagobj in alltags:
-                if tagobj.tag == tagcore.tag:
-                    break
-            else:
-                log.debug("Instantiating Tag() for %s", tagcore.tag)
-                Tag(tagcore, self.callbacks)
-
-        self.update_tag_lists()
-
-        # Hooks
         on_hook("curses_eval_tags_changed", self.on_eval_tags_changed, self)
         on_hook("curses_items_added", self.on_items_added, self)
         on_hook("curses_stories_added", self.on_stories_added, self)
@@ -81,8 +65,6 @@ class TagList(GuiBase):
         on_hook("curses_update_complete", self.on_update_complete, self)
         on_hook("curses_del_tagcore", self.on_del_tagcore, self)
 
-        config_lock.release_write()
-
         args = {
             "cursor-offset": ("[cursor-offset]", self.type_cursor_offset),
             "item-list": ("[item-list]: List of item indices (tab complete to show)\n  Simple: 1,3,6,5\n  Ranges: 1-100\n  All: *\n  Selected item: .\n  Domains tag,1,2,3 for 1,2,3 of current tag", self.type_item_list, self.hook_item_list),