Index: st2.py
==================================================================
--- st2.py
+++ st2.py
@@ -3,11 +3,11 @@
# api: python
# type: application
# title: streamtuner2
# description: directory browser for internet radio / audio streams
# depends: gtk, pygtk, xml.dom.minidom, threading, lxml, pyquery, kronos
-# version: 2.1.0
+# version: 2.0.9.5
# author: mario salzer
# license: public domain
# url: http://freshmeat.net/projects/streamtuner2
# config:
# category: multimedia
@@ -127,24 +127,24 @@
# constructor
def __init__(self):
# gtkrc stylesheet
- self.load_theme(), gui_startup(0.05)
+ self.load_theme(), gui_startup(1/20)
# instantiate gtk/glade widgets in current object
gtk.Builder.__init__(self)
- gtk.Builder.add_from_file(self, conf.find_in_dirs([".", conf.share], ui_file)), gui_startup(0.10)
+ gtk.Builder.add_from_file(self, conf.find_in_dirs([".", conf.share], ui_file)), gui_startup(2/20)
# manual gtk operations
self.extensionsCTM.set_submenu(self.extensions) # duplicates Station>Extension menu into stream context menu
# initialize channels
self.channels = {
"bookmarks": bookmarks(parent=self), # this the remaining built-in channel
"shoutcast": None,#shoutcast(parent=self),
}
- gui_startup(0.15)
+ gui_startup(3/20)
self.load_plugin_channels() # append other channel modules / plugins
# load application state (widget sizes, selections, etc.)
try:
@@ -159,18 +159,18 @@
self.channels[id].shown = winlayout[id+"_list"].get("row:selected", 0) # actually just used as boolean flag (for late loading of stream list), selection bar has been positioned before already
except:
pass # fails for disabled/reordered plugin channels
# display current open channel/notebook tab
- gui_startup(0.90)
+ gui_startup(17/20)
self.current_channel = self.current_channel_gtk()
try: self.channel().first_show()
except: print("channel .first_show() initialization error")
# bind gtk/glade event names to functions
- gui_startup(0.95)
+ gui_startup(19/20)
self.connect_signals(dict( {
"gtk_main_quit" : self.gtk_main_quit, # close window
# treeviews / notebook
"on_stream_row_activated" : self.on_play_clicked, # double click in a streams list
"on_category_clicked": self.on_category_clicked, # new selection in category list
@@ -220,11 +220,11 @@
"streamedit_new": streamedit.new,
"streamedit_cancel": streamedit.cancel,
}.items() + self.add_signals.items() ))
# actually display main window
- gui_startup(0.99)
+ gui_startup(99/100)
self.win_streamtuner2.show()
# WHY DON'T YOU WANT TO WORK?!
#self.shoutcast.gtk_list.set_enable_search(True)
#self.shoutcast.gtk_list.set_search_column(4)
@@ -435,15 +435,15 @@
while ((not text) and (type(text)==str) and len(sbar_msg)):
sbar_msg.pop()
mygtk.do(lambda:self.statusbar.pop(sbar_cid))
# progressbar
if (type(text)==float):
- if (text >= 1.0): # completed
+ if (text >= 999/1000): # completed
mygtk.do(lambda:self.progress.hide())
else: # show percentage
mygtk.do(lambda:self.progress.show() or self.progress.set_fraction(text))
- if (text <= 0.0): # unknown state
+ if (text <= 0): # unknown state
mygtk.do(lambda:self.progress.pulse())
# add text
elif (type(text)==str):
sbar_msg.append(1)
mygtk.do(lambda:self.statusbar.push(sbar_cid, text))
@@ -461,11 +461,11 @@
order = [module.strip() for module in conf.channel_order.lower().replace(".","_").replace("-","_").split(",")]
ls = [module for module in (order) if (module in ls)] + [module for module in (ls) if (module not in order)]
# step through
for module in ls:
- gui_startup(0.2 + 0.7 * float(ls.index(module))/len(ls), "loading module "+module)
+ gui_startup(2/10 + 7/10 * float(ls.index(module))/len(ls), "loading module "+module)
# skip module if disabled
if conf.plugins.get(module, 1) == False:
__print__("disabled plugin:", module)
continue
@@ -485,11 +485,11 @@
self.channel_names.append(module)
# other plugin types
else:
self.features[module] = plugin_class(parent=self)
- except Exception, e:
+ except Exception as e:
print("error initializing:", module, ", exception:")
import traceback
traceback.print_exc()
# default plugins
@@ -513,11 +513,11 @@
# apply gtkrc stylesheet
def load_theme(self):
if conf.get("theme"):
for dir in (conf.dir, conf.share, "/usr/share"):
- f = dir + "/themes/" + conf.theme + "/gtk-2.0/gtkrc"
+ f = dir + "/themes/" + conf.theme + "/gtk-2"+".0/gtkrc"
if os.path.exists(f):
gtk.rc_parse(f)
pass
@@ -540,14 +540,14 @@
# auxiliary window: about dialog
class AboutStreamtuner2:
# about us
def __init__(self):
a = gtk.AboutDialog()
- a.set_version("2.0.9")
+ a.set_version("2.0.9.5")
a.set_name("streamtuner2")
a.set_license("Public Domain\n\nNo Strings Attached.\nUnrestricted distribution,\nmodification, use.")
- a.set_authors(["Mario Salzer \n\nConcept based on streamtuner 0.99.99 from\nJean-Yves Lefort, of which some code remains\nin the Google stations plugin.\n\n\nMyOggRadio plugin based on cooperation\nwith Christian Ehm. "])
+ a.set_authors(["Mario Salzer \n\nConcept based on streamtuner 0."+"99."+"99 from\nJean-Yves Lefort, of which some code remains\nin the Google stations plugin.\n\n\nMyOggRadio plugin based on cooperation\nwith Christian Ehm. "])
a.set_website("http://milki.include-once.org/streamtuner2/")
a.connect("response", lambda a, ok: ( a.hide(), a.destroy() ) )
a.show()
@@ -928,11 +928,11 @@
# desc
api = "streamtuner2"
module = "bookmarks"
title = "bookmarks"
- version = 0.4
+ version = 4/10
base_url = "file:.config/streamtuner2/bookmarks.json"
listformat = "*/*"
# i like this
@@ -1100,11 +1100,11 @@
#-- startup progress bar
progresswin, progressbar = 0, 0
-def gui_startup(p=0.0, msg="streamtuner2 is starting"):
+def gui_startup(p=0/100, msg="streamtuner2 is starting"):
global progresswin,progressbar
if not progresswin:
# GtkWindow "progresswin"
@@ -1148,11 +1148,11 @@
if len(sys.argv) < 2:
# prepare for threading in Gtk+ callbacks
gobject.threads_init()
- gui_startup(0.05)
+ gui_startup(1/100)
# prepare main window
main = StreamTunerTwo()
# module coupling
@@ -1165,11 +1165,11 @@
config_dialog.open(None)
del conf.firstrun
# run
- gui_startup(1.00)
+ gui_startup(100/100)
gtk.main()
# invoke command-line interface
else: