Check-in [8d130efe89]
Overview
Comment: | select: is now preparsed in pluginconf (but configwin/combobox expected tuple-list instead of dict till now; might need further changes) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8d130efe89efe550e3fe78e326f5775b |
User & Date: | mario on 2020-10-31 16:59:17 |
Other Links: | manifest | tags |
Context
2020-12-12
| ||
14:16 | Cover ImportError with custom explanation check-in: 6f0655d209 user: mario tags: trunk | |
2020-10-31
| ||
16:59 | select: is now preparsed in pluginconf (but configwin/combobox expected tuple-list instead of dict till now; might need further changes) check-in: 8d130efe89 user: mario tags: trunk | |
2020-10-30
| ||
19:34 | updated html dump check-in: 4caf8247dc user: mario tags: trunk | |
Changes
Modified pluginconf.py from [9101ebb380] to [8d185cdf67].
1 2 3 4 5 6 | # encoding: UTF-8 # api: python # type: extract # category: io # title: Plugin configuration # description: Read meta data, pyz/package contents, module locating | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # encoding: UTF-8 # api: python # type: extract # category: io # title: Plugin configuration # description: Read meta data, pyz/package contents, module locating # version: 0.7.1 # priority: core # docs: https://fossil.include-once.org/pluginspec/ # url: http://fossil.include-once.org/streamtuner2/wiki/plugin+meta+data # config: - # # Provides plugin lookup and meta data extraction utility functions. # It's used to abstract module+option management in applications. |
︙ | ︙ | |||
293 294 295 296 297 298 299 | "type": None, "name": None, "description": "", "value": None } for field in rx.options.findall(entry): opt[field[0]] = (field[1] or field[2] or field[3] or "").strip() | | > > > > > > > > > > > > > > > > > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | "type": None, "name": None, "description": "", "value": None } for field in rx.options.findall(entry): opt[field[0]] = (field[1] or field[2] or field[3] or "").strip() # normalize type opt["type"] = config_opt_type_map.get(opt["type"], opt["type"] or "str") # preparse select: if opt.get("select"): opt["select"] = config_opt_parse_select(opt.get("select", "")) config.append(opt) return config # split up `select: 1=on|2=more|3=title` or `select: foo|bar|lists` def config_opt_parse_select(s): if re.search("([=:])", s): return dict(rx.select_dict.findall(s)) else: return dict([(v, v) for v in rx.select_list.findall(s)]) # normalize type:names to `str`, `bool`, `int`, `select`, `dict` config_opt_type_map = dict( text="str", string="str", boolean="bool", checkbox="bool", integer="int", number="int", choice="select", options="select", table="dict", array="dict" ) # Comment extraction regexps # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # Pretty crude comment splitting approach. But works # well enough already. Technically a YAML parser would # do better; but is likely overkill. |
︙ | ︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 | ["':$]? (\w*) ["']? # key or ":key" or '$key' \s* [:=] \s* # "=" or ":" (?: " ([^"]*) " | ' ([^']*) ' # "quoted" or 'singl' values | ([^,]*) # or unquoted literals ) """, re.X) # ArgumentParser options conversion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # As variation of in-application config: options, this method converts # cmdline argument specifiers. # | > > > | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | ["':$]? (\w*) ["']? # key or ":key" or '$key' \s* [:=] \s* # "=" or ":" (?: " ([^"]*) " | ' ([^']*) ' # "quoted" or 'singl' values | ([^,]*) # or unquoted literals ) """, re.X) select_dict = re.compile("(\w+)\s*[=:>]+\s*([^=,|:]+)") select_list = re.compile("\s*([^,|;]+)\s*") # ArgumentParser options conversion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # As variation of in-application config: options, this method converts # cmdline argument specifiers. # |
︙ | ︙ |
Modified uikit.py from [d6b56fa41f] to [42b5afa6c8].
︙ | ︙ | |||
700 701 702 703 704 705 706 707 708 709 710 711 712 713 | self.add_attribute(cell, "text", 1) if no_scroll: self.connect("scroll_event", self.no_scroll) # collect entries self.ls = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.set_model(self.ls) if type(entries[0]) is not tuple: entries = zip(entries, entries) for key,value in entries: self.ls.append([key, value]) # activate dropdown of given value def set_default(self, value): | > | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | self.add_attribute(cell, "text", 1) if no_scroll: self.connect("scroll_event", self.no_scroll) # collect entries self.ls = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.set_model(self.ls) entries = entries.items() if type(entries[0]) is not tuple: entries = zip(entries, entries) for key,value in entries: self.ls.append([key, value]) # activate dropdown of given value def set_default(self, value): |
︙ | ︙ |