Index: channels/__init__.py ================================================================== --- channels/__init__.py +++ channels/__init__.py @@ -444,17 +444,16 @@ uikit.do(self.display_categories) # insert content into gtk category list def display_categories(self): + log.UI(self.module+".display_categories()", "mk tree, expand_all, select first path, currentcat") # rebuild gtk.TreeView - log.UI("display_categoris: tree→gtk_cat") uikit.tree(self.gtk_cat, self.categories, title="Category", icon=gtk.STOCK_OPEN) # if it's a short list of categories, there's probably subfolders - log.UI("display_categoris: expand_all") if len(self.categories) < 20: self.gtk_cat.expand_all() # select any first element self.gtk_cat.get_selection().select_path("0") #set_cursor Index: channels/jamendo.py ================================================================== --- channels/jamendo.py +++ channels/jamendo.py @@ -6,11 +6,11 @@ # version: 2.2 # category: radio # url: http://jamendo.com/ # depends: json # config: -# { name: jamendo_stream_format, value: ogg, type: select, select: "ogg=Ogg Vorbis, 112kbit/s|mp32=MP3, 192kbit/s VBR|mp31=MP3, 96kbit/s|flac=Xiph FLAC, ≳600kbit/s", description: "Default streaming audio format for tracks, albums and playlists. Radios are just MP3." } +# { name: jamendo_stream_format, value: ogg, type: select, select: "ogg=Ogg Vorbis, 112kbit/s|mp32=MP3, 192kbit/s VBR|mp31=MP3, 96kbit/s|flac=Xiph FLAC, ≳600kbit/s", description: "Audio format for tracks, albums, playlists." } # { name: jamendo_image_size, value: 50, type: select, select: "25=25px|35=35px|50=50px|55=55px|60=60px|65=65px|70=70px|75=75px|85=85px|100=100px|130=130px|150=150px|200=200px|300=300px", description: "Preview images size (height and width) for albums or tracks." } # { name: jamendo_count, value: 1, type:text, description: "How many result sets (200 entries each) to retrieve." } # priority: default # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAwNJREFUOI1lk0toXGUYhp/v/8+ZzDQzmdZMZ8YSkxIQCWTTYsALLsQsUsWFQgJeEJQqIigUvBK0FBQULIJKMEKrFjdOW9xoW1AbRdRCEYtd2GCxxUQbk8bMrTNnzpn//1xMLYLv6l2877N7oBcB0GMY Index: config.py ================================================================== --- config.py +++ config.py @@ -9,11 +9,12 @@ # { arg: -e, type: str, name: enable[], description: Add channel plugin. } # { arg: --gtk3, type: boolean, name: gtk3, description: Start with Gtk3 interface. } # { arg: -D, type: boolean, name: debug, description: Enable debug messages on console } # { arg: action, type: str *, name: action[], description: CLI interface commands. } # { arg: -x, type: boolean, name: exit, hidden: 1 } -# version: 2.6 +# { arg: --nt, type: boolean, name: nothreads, description: Disable threading/gtk_idle UI. } +# version: 2.7 # priority: core # # In the main application or module files which need access # to a global conf.* object, just import this module as follows: # @@ -118,10 +119,11 @@ "search": 1, "streamedit": 1, "configwin": 1, } self.tmp = os.environ.get("TEMP", "/tmp") + "/streamtuner2" + self.nothreads = 0 self.max_streams = "500" self.show_bookmarks = 1 self.show_favicons = 1 self.load_favicon = 1 self.heuristic_bookmark_update = 0 @@ -285,10 +287,11 @@ # Copy args fields into conf. dict def apply_args(self, args): self.debug = args.debug + self.nothreads = args.nothreads if args.exit: sys.exit(1) for p_id in (args.disable or []): self.plugins[p_id] = 0 for p_id in (args.enable or []): @@ -487,11 +490,11 @@ method = self.method.upper() if method != "ERR": if "debug" in conf and not conf.debug: return # color/prefix - method = r"[{}[{}]".format(self.colors.get(method, "47m"), method) + method = r"[{}[{}]".format(self.colors.get(method.split("_")[0], "47m"), method) # output print(method + " " + " ".join([str(a) for a in args]), file=sys.stderr) # Colors colors = { @@ -498,10 +501,11 @@ "ERR": "31m", # red ERROR "INIT": "31m", # red INIT ERROR "PROC": "32m", # green PROCESS "CONF": "33m", # brown CONFIG DATA "UI": "34m", # blue USER INTERFACE BEHAVIOUR + "UIKIT":"38;5;222;48;5;235m", # THREAD/UIKIT/IDLE TASKS "HTTP": "35m", # magenta HTTP REQUEST "DATA": "36m", # cyan DATA "INFO": "37m", # gray INFO "STAT": "37m", # gray CONFIG STATE } Index: gtk3.xml.gz ================================================================== --- gtk3.xml.gz +++ gtk3.xml.gz cannot compute difference between binary files Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -294,10 +294,12 @@ lambda: ( self.channel().load(category,reload), reload and self.bookmarks.heuristic_update(self.current_channel,category) ) ) # Thread a function, add to worker pool (for utilizing stop button) def thread(self, target, *args): + if conf.nothreads: + return target(*args) thread = Thread(target=target, args=args) thread.start() self.working.append(thread) Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -402,35 +402,39 @@ # Spool gtk update calls from non-main threads (optional immediate=1 flag to run task next, not last) @staticmethod def do(callback, *args, **kwargs): - pos = kwargs.get("immediate", -1) - if pos and pos >= 0: + name = inspect.getsource(callback).strip() if callback.__name__=='' else str(callback) + if kwargs.get("immediate"): del kwargs["immediate"] pos = 0 - if uikit.idle_run: - log.UIKIT_DORUN(str(callback)) + else: + pos = -1 + # Run callback right away + if uikit.in_idle or conf.nothreads: + log.UIKIT_RUN_NOW(name) callback(*args, **kwargs) + # Spool them for Gtk idle handling else: - log.UIKIT_SPOOL(str(callback)) - uikit.idle_tasks.insert(pos, [lambda: callback(*args, **kwargs), str(callback)]) + log.UIKIT_SPOOL(name) + uikit.idle_tasks.insert(pos, [lambda: callback(*args, **kwargs), name]) gobject.idle_add(uikit.idle_do) # Collect tasks to perform in gtk.main loop idle_tasks = [] - idle_run = False + in_idle = False # Execute UI updating tasks in order @staticmethod def idle_do(): - uikit.idle_run = True + uikit.in_idle = True if uikit.idle_tasks: - task, callback = uikit.idle_tasks.pop(0) - log.UIKIT_EXEC(callback) + task, name = uikit.idle_tasks.pop(0) + log.UIKIT_EXEC(name) task() - uikit.idle_run = False + uikit.in_idle = False return len(uikit.idle_tasks) > 0 # adds background color to widget,