Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Check-in [04daa96360]

Overview
Comment:Fix statusbar #257: minor unicode fixes (wasn't showing up due to str/unicode in Py2, imported compat.unicode for Py3 now)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 04daa963604365f6d687a25cb25216c727ee71ce
User & Date: mario on 2016-10-08 14:42:53
Other Links: manifest | tags
Context
2016-10-08
14:43
Removed stray `print` statement check-in: 36dcba6639 user: mario tags: trunk
14:42
Fix statusbar #257: minor unicode fixes (wasn't showing up due to str/unicode in Py2, imported compat.unicode for Py3 now) check-in: 04daa96360 user: mario tags: trunk
04:07
Fix HTML assembling (<body>.+?</body> cleanup for PyQuery to see all entries). check-in: ea2010c673 user: mario tags: trunk
Changes

Modified st2.py from [e38693d10f] to [44d62e1137].

37
38
39
40
41
42
43

44
45
46
47
48
49
50
import os
import re
from copy import copy
import inspect
import traceback
from threading import Thread
import time


# add library path (either global setup, or pyzip basename)
if not os.path.dirname(__file__) in sys.path:
    sys.path.insert(0, os.path.dirname(__file__))

# initializes itself, so all conf.vars are available right away
from config import *







>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import re
from copy import copy
import inspect
import traceback
from threading import Thread
import time
from compat2and3 import *

# add library path (either global setup, or pyzip basename)
if not os.path.dirname(__file__) in sys.path:
    sys.path.insert(0, os.path.dirname(__file__))

# initializes itself, so all conf.vars are available right away
from config import *
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389

390
391
392
393
394
395
396



    # Shortcut to statusbar and progressbar (receives either a string, or a float).
    def status(self, text=None, timeout=3):
        self.status_last = time.time() + timeout
        gobject.timeout_add(int(timeout*1000), self.status_clear)

        # progressbar
        if isinstance(text, (int, float)):
            if (text <= 0):  # unknown state
                uikit.do(self.progress.pulse, immediate=1)
            elif text >= 0.999 or text < 0.0:  # completed
                uikit.do(self.progress.hide)
            else:  # show percentage
                uikit.do(self.progress.show, immediate=1)
                uikit.do(self.progress.set_fraction, text, immediate=1)
        # add text
        elif isinstance(text, (str)):
            uikit.do(self.statusbar.set_text, text)
        # clean up
        else:
            self.status_clear(anyway=True)

    # Clean up after 3 seconds
    def status_clear(self, anyway=False):
        if anyway or time.time() >= self.status_last:

            self.statusbar.set_text("")
            self.progress.hide()
            return False
        else:
            return True









>










|








>







365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399



    # Shortcut to statusbar and progressbar (receives either a string, or a float).
    def status(self, text=None, timeout=3):
        self.status_last = time.time() + timeout
        gobject.timeout_add(int(timeout*1000), self.status_clear)
        #log.UI("progressbar := %s" %text)
        # progressbar
        if isinstance(text, (int, float)):
            if (text <= 0):  # unknown state
                uikit.do(self.progress.pulse, immediate=1)
            elif text >= 0.999 or text < 0.0:  # completed
                uikit.do(self.progress.hide)
            else:  # show percentage
                uikit.do(self.progress.show, immediate=1)
                uikit.do(self.progress.set_fraction, text, immediate=1)
        # add text
        elif isinstance(text, (str, unicode)):
            uikit.do(self.statusbar.set_text, text)
        # clean up
        else:
            self.status_clear(anyway=True)

    # Clean up after 3 seconds
    def status_clear(self, anyway=False):
        if anyway or time.time() >= self.status_last:
            #log.UI("progressbar.hide()")
            self.statusbar.set_text("")
            self.progress.hide()
            return False
        else:
            return True