Check-in [a5893e591c]
Overview
Comment: | Move DND insert_rows() into GenericChannel. Add load(y=) parameter to scroll back to previous position after insert_rows(). Reenable select_path("0") after reloading category list. (Fixes initial startup.) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a5893e591c0e69a82d41b47cef16e631 |
User & Date: | mario on 2015-04-22 20:50:38 |
Original Comment: | Move DND insert_rows() into GenericChannel. Add load(y=) parameter to scroll back to previous position after insert_rows(). |
Other Links: | manifest | tags |
Context
2015-04-22
| ||
20:52 | Fix .desktop file exporting. Add mime_guess() for streaming url. Move insert_rows() implementation out of DND module. check-in: 749715cb39 user: mario tags: trunk | |
20:50 | Move DND insert_rows() into GenericChannel. Add load(y=) parameter to scroll back to previous position after insert_rows(). Reenable select_path("0") after reloading category list. (Fixes initial startup.) check-in: a5893e591c user: mario tags: trunk | |
20:49 | Let bookmarks channel use generic.load() to reapply scroll position y= after inserts. check-in: a6ba97bce0 user: mario tags: trunk | |
Changes
Modified channels/__init__.py from [5cecf16359] to [eada7c8200].
︙ | ︙ | |||
231 232 233 234 235 236 237 | if self.datamap == GenericChannel.datamap: self.datamap = copy.deepcopy(self.datamap) for i,row in enumerate(self.datamap): if row[2][0] == search: row[0] = title | | | < | > | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | if self.datamap == GenericChannel.datamap: self.datamap = copy.deepcopy(self.datamap) for i,row in enumerate(self.datamap): if row[2][0] == search: row[0] = title # Called on switching genre/category. # Either fetches new stream data, or displays list from cache. def load(self, category, force=False, y=None): # called to early if not category: print "load(None)" return self.current = category # get data from cache or download if force or not category in self.streams: log.PROC("load", "update_streams") self.status("Updating streams...") self.status(-0.1) if category == "empty": |
︙ | ︙ | |||
279 280 281 282 283 284 285 | else: # parse error self.status("Category parsed empty.") self.streams[category] = self.nothing_found log.INFO("Oooops, parser returned nothing for category " + category) | | > > | > > < | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | else: # parse error self.status("Category parsed empty.") self.streams[category] = self.nothing_found log.INFO("Oooops, parser returned nothing for category " + category) # Update treeview/model (if category is still selected) if self.current == category: uikit.do(lambda:[ uikit.columns(self.gtk_list, self.datamap, self.prepare(self.streams[category])), y and self.gtk_list.scroll_to_point(0, y) # scroll to previous position ]) # set pointer self.status("") self.status(1.0) # store current streams data def save(self): conf.save("cache/" + self.module, self.streams, gz=1) |
︙ | ︙ | |||
451 452 453 454 455 456 457 | 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 if len(self.categories) < 20: self.gtk_cat.expand_all() # select any first element | | > > > > > > > > > > > > > > > > > > > > | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | 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 if len(self.categories) < 20: self.gtk_cat.expand_all() # select any first element self.gtk_cat.get_selection().select_path("0") #set_cursor self.currentcat() # selected category def currentcat(self): (model, iter) = self.gtk_cat.get_selection().get_selected() if (type(iter) == gtk.TreeIter): self.current = model.get_value(iter, 0) return self.current # Insert/append new station rows - used by importing/drag'n'drop plugins def insert_rows(self, rows, y=None): streams = self.streams[self.current] tv = self.gtk_list # Inserting at correct row requires deducing index from dnd `y` position if y is not None: i_pos = (tv.get_path_at_pos(10, y) or [[len(streams) + 1]])[0][0] for row in rows: streams.insert(i_pos - 1, row) i_pos = i_pos + 1 else: streams += rows # Now appending to the liststore directly would be even nicer y = int(tv.get_vadjustment().get_value()) uikit.do(self.load, self.current, y=y) #--------------------------- actions --------------------------------- # Invoke action.play() for current station. |
︙ | ︙ |