Check-in [07d2a291cd]
Overview
Comment: | Add conf.get_data() alias, which automatically fetches resource relative to config module (that is, works on the global path, or within pyzip archive). Move module_list() from channels. into config, as it combines plugins and config management anyway. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
07d2a291cd491d4947f1280d7ed8df05 |
User & Date: | mario on 2015-04-01 17:39:44 |
Other Links: | manifest | tags |
Context
2015-04-01
| ||
20:31 | Update documentation files (dependencies and manual installation paths). check-in: 186f91779d user: mario tags: trunk | |
17:39 | Add conf.get_data() alias, which automatically fetches resource relative to config module (that is, works on the global path, or within pyzip archive). Move module_list() from channels. into config, as it combines plugins and config management anyway. check-in: 07d2a291cd user: mario tags: trunk | |
15:49 | Trim down plugin comment. check-in: c8c55c79da user: mario tags: trunk | |
Changes
Modified NEWS from [aa1a43b578] to [57a25343a1].
|
Modified PKG-INFO from [30c39c6021] to [c177f44b1a].
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | Metadata-Version: 1.0 Name: streamtuner2 |
Modified channels/__init__.py from [ed3951c050] to [3382badfa2].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - - + - - - - - - - - - - - - - - - - - | import action import favicon import os.path import xml.sax.saxutils import re import copy import inspect |
︙ | |||
126 127 128 129 130 131 132 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - + | # constructor def __init__(self, parent=None): #self.streams = {} self.gtk_list = None self.gtk_cat = None self.module = self.__class__.__name__ |
︙ | |||
552 553 554 555 556 557 558 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | - + | vbox.pack2(sw2, resize=True, shrink=True) # prepare label pixbuf = None if "png" in self.meta: pixbuf = uikit.pixbuf(self.meta["png"]) else: |
︙ |
Modified config.py from [a316308630] to [ec183e5649].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + - + - + + + + + + - + - + + + + + | # # encoding: UTF-8 # api: streamtuner2 # type: class # title: global config object # description: reads ~/.config/streamtuner/*.json files # config: {type:var, name:z, description:v} # # In the main application or module files which need access |
︙ | |||
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | except: pass for server in varhosts: if server in netrc: return netrc[server] # Retrieve content from install path or pyzip archive (alias for pkgutil.get_data) # def get_data(fn, decode=False): try: bin = pkgutil.get_data("config", fn) if decode: return bin.decode("utf-8") else: return str(bin) except: pass # Search through ./channels/ and get module basenames. # Also order them by conf.channel_order # def module_list(): # Should list plugins within zips as well as local paths ls = pkgutil.iter_modules([conf.share+"/channels", "channels"]) ls = [name for loader,name,ispkg in ls] # resort with tab order 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)] return ls # Plugin meta data extraction # # Extremely crude version for Python and streamtuner2 plugin usage. # Fetches module source, or reads from filename / out of zip package. # def plugin_meta(fn=None, src=None, frame=1): # get source directly from caller if not src and not fn: module = inspect.getmodule(sys._getframe(frame)) fn = inspect.getsourcefile(module) src = inspect.getcomments(module) |
︙ |
Modified st2.py from [e68343b5e8] to [098afe2087].
︙ | |||
405 406 407 408 409 410 411 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | - + | pass # load plugins from /usr/share/streamtuner2/channels/ def load_plugin_channels(self): # initialize plugin modules (pre-ordered) |
︙ |
Modified uikit.py from [e359ed9045] to [37cbc8f921].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + - | # With the methodes .app_state() and .app_restore() named gtk widgets # can be queried for attributes. The methods return a saveable dict, # which contain current layout options for a few Widget types. Saving # and restoring must be handled elsewhere. # debug |
︙ | |||
56 57 58 59 60 61 62 | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + | import gtk import gobject GdkPixbuf = gtk.gdk empty_pixbuf = GdkPixbuf.Pixbuf(gtk.gdk.COLORSPACE_RGB,True,8,16,16) empty_pixbuf.fill(0xFFFFFFFF) # prepare gtkbuilder data |
︙ | |||
611 612 613 614 615 616 617 | 610 611 612 613 614 615 616 617 618 619 620 621 | - + | # class AboutStreamtuner2(AuxiliaryWindow): def __init__(self, parent): a = gtk.AboutDialog() a.set_name(parent.meta["id"]) a.set_version(parent.meta["version"]) a.set_license(parent.meta["license"]) |