trackma 0.4__py2.7.egg → 0.5__py2.7.egg
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- EGG-INFO/PKG-INFO +1 -1
- EGG-INFO/SOURCES.txt +2 -0
- trackma/__init__.pyc +0 -0
- trackma/accounts.py +36 -1
- trackma/accounts.pyc +0 -0
- trackma/data/shikimori.jpg +0 -0
- trackma/data.py +33 -20
- trackma/data.pyc +0 -0
- trackma/engine.py +82 -11
- trackma/engine.pyc +0 -0
- trackma/extras/AnimeInfoExtractor.pyc +0 -0
- trackma/extras/__init__.pyc +0 -0
- trackma/extras/plex.pyc +0 -0
- trackma/lib/__init__.pyc +0 -0
- trackma/lib/lib.pyc +0 -0
- trackma/lib/libanilist.py +65 -17
- trackma/lib/libanilist.pyc +0 -0
- trackma/lib/libhb.py +4 -5
- trackma/lib/libhb.pyc +0 -0
- trackma/lib/libmal.py +10 -7
- trackma/lib/libmal.pyc +0 -0
- trackma/lib/libmelative.py +1 -1
- trackma/lib/libmelative.pyc +0 -0
- trackma/lib/libshikimori.py +338 -0
- trackma/lib/libshikimori.pyc +0 -0
- trackma/lib/libvndb.py +1 -0
- trackma/lib/libvndb.pyc +0 -0
- trackma/messenger.pyc +0 -0
- trackma/tracker.py +64 -17
- trackma/tracker.pyc +0 -0
- trackma/ui/__init__.pyc +0 -0
- trackma/ui/cli.py +191 -70
- trackma/ui/cli.pyc +0 -0
- trackma/ui/curses.py +14 -3
- trackma/ui/curses.pyc +0 -0
- trackma/ui/gtkui.py +341 -110
- trackma/ui/gtkui.pyc +0 -0
- trackma/ui/qtui.py +1243 -327
- trackma/ui/qtui.pyc +0 -0
- trackma/utils.py +118 -38
- trackma/utils.pyc +0 -0
trackma/ui/gtkui.py
CHANGED
|
@@ -115,6 +115,8 @@ class Trackma_gtk(object):
|
|
|
115
115
|
self.main.connect('destroy', self.on_destroy)
|
|
116
116
|
self.main.set_title('Trackma-gtk ' + utils.VERSION)
|
|
117
117
|
gtk.window_set_default_icon_from_file(utils.datadir + '/data/icon.png')
|
|
118
|
+
if self.config['remember_geometry']:
|
|
119
|
+
self.main.resize(self.config['last_width'], self.config['last_height'])
|
|
118
120
|
|
|
119
121
|
# Menus
|
|
120
122
|
mb_show = gtk.Menu()
|
|
@@ -124,12 +126,12 @@ class Trackma_gtk(object):
|
|
|
124
126
|
mb_scanlibrary.connect("activate", self.do_scanlibrary)
|
|
125
127
|
self.mb_info = gtk.MenuItem('Show details...')
|
|
126
128
|
self.mb_info.connect("activate", self.do_info)
|
|
127
|
-
mb_web = gtk.MenuItem("Open web site")
|
|
128
|
-
mb_web.connect("activate", self.do_web)
|
|
129
|
-
mb_copy = gtk.MenuItem("Copy title to clipboard")
|
|
130
|
-
mb_copy.connect("activate", self.do_copytoclip)
|
|
131
|
-
mb_alt_title = gtk.MenuItem("Set alternate title...")
|
|
132
|
-
mb_alt_title.connect("activate", self.do_altname)
|
|
129
|
+
self.mb_web = gtk.MenuItem("Open web site")
|
|
130
|
+
self.mb_web.connect("activate", self.do_web)
|
|
131
|
+
self.mb_copy = gtk.MenuItem("Copy title to clipboard")
|
|
132
|
+
self.mb_copy.connect("activate", self.do_copytoclip)
|
|
133
|
+
self.mb_alt_title = gtk.MenuItem("Set alternate title...")
|
|
134
|
+
self.mb_alt_title.connect("activate", self.do_altname)
|
|
133
135
|
self.mb_delete = gtk.ImageMenuItem(gtk.STOCK_DELETE)
|
|
134
136
|
self.mb_delete.connect("activate", self.do_delete)
|
|
135
137
|
self.mb_exit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
|
|
@@ -142,10 +144,10 @@ class Trackma_gtk(object):
|
|
|
142
144
|
mb_show.append(gtk.SeparatorMenuItem())
|
|
143
145
|
mb_show.append(self.mb_play)
|
|
144
146
|
mb_show.append(self.mb_info)
|
|
145
|
-
mb_show.append(mb_web)
|
|
147
|
+
mb_show.append(self.mb_web)
|
|
146
148
|
mb_show.append(gtk.SeparatorMenuItem())
|
|
147
|
-
mb_show.append(mb_copy)
|
|
148
|
-
mb_show.append(mb_alt_title)
|
|
149
|
+
mb_show.append(self.mb_copy)
|
|
150
|
+
mb_show.append(self.mb_alt_title)
|
|
149
151
|
mb_show.append(gtk.SeparatorMenuItem())
|
|
150
152
|
mb_show.append(self.mb_delete)
|
|
151
153
|
mb_show.append(gtk.SeparatorMenuItem())
|
|
@@ -209,6 +211,13 @@ class Trackma_gtk(object):
|
|
|
209
211
|
|
|
210
212
|
vbox.pack_start(mb, False, False, 0)
|
|
211
213
|
|
|
214
|
+
# Toolbar
|
|
215
|
+
#toolbar = gtk.Toolbar()
|
|
216
|
+
#toolbar.insert_stock(gtk.STOCK_REFRESH, "Sync", "Sync", None, None, 0)
|
|
217
|
+
#toolbar.insert_stock(gtk.STOCK_ADD, "Sync", "Sync", None, None, 1)
|
|
218
|
+
#toolbar.insert_stock(gtk.STOCK_MEDIA_PLAY, "Sync", "Sync", None, None, 2)
|
|
219
|
+
#vbox.pack_start(toolbar, False, False, 0)
|
|
220
|
+
|
|
212
221
|
self.top_hbox = gtk.HBox(False, 10)
|
|
213
222
|
self.top_hbox.set_border_width(5)
|
|
214
223
|
|
|
@@ -246,34 +255,39 @@ class Trackma_gtk(object):
|
|
|
246
255
|
line2_t.set_size_request(70, -1)
|
|
247
256
|
line2_t.set_alignment(0, 0.5)
|
|
248
257
|
line2.pack_start(line2_t, False, False, 0)
|
|
249
|
-
self.show_ep_num = gtk.SpinButton()
|
|
250
|
-
self.show_ep_num.set_sensitive(False)
|
|
251
|
-
self.show_ep_num.connect("activate", self.do_update)
|
|
252
|
-
#self.show_ep_num.connect("value_changed", self.do_update)
|
|
253
|
-
line2.pack_start(self.show_ep_num, False, False, 0)
|
|
254
258
|
|
|
255
259
|
# Buttons
|
|
256
260
|
top_buttons = gtk.HBox(False, 5)
|
|
257
261
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
self.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
self.rem_epp_button = gtk.Button('-')
|
|
262
|
+
rem_icon = gtk.Image()
|
|
263
|
+
rem_icon.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON)
|
|
264
|
+
self.rem_epp_button = gtk.Button()
|
|
265
|
+
self.rem_epp_button.set_image(rem_icon)
|
|
264
266
|
self.rem_epp_button.connect("clicked", self.do_rem_epp)
|
|
265
267
|
self.rem_epp_button.set_sensitive(False)
|
|
266
268
|
line2.pack_start(self.rem_epp_button, False, False, 0)
|
|
267
269
|
|
|
268
|
-
self.
|
|
269
|
-
self.
|
|
270
|
-
self.
|
|
271
|
-
|
|
270
|
+
self.show_ep_button = gtk.Button()
|
|
271
|
+
self.show_ep_button.set_relief(gtk.RELIEF_NONE)
|
|
272
|
+
self.show_ep_button.connect("clicked", self._show_episode_entry)
|
|
273
|
+
self.show_ep_button.set_label("-")
|
|
274
|
+
self.show_ep_button.set_size_request(40, -1)
|
|
275
|
+
line2.pack_start(self.show_ep_button, False, False, 0)
|
|
272
276
|
|
|
273
|
-
self.
|
|
274
|
-
self.
|
|
275
|
-
self.
|
|
276
|
-
|
|
277
|
+
self.show_ep_num = gtk.Entry()
|
|
278
|
+
self.show_ep_num.set_sensitive(False)
|
|
279
|
+
self.show_ep_num.connect("activate", self.do_update)
|
|
280
|
+
self.show_ep_num.connect("focus-out-event", self._hide_episode_entry)
|
|
281
|
+
self.show_ep_num.set_size_request(40, -1)
|
|
282
|
+
line2.pack_start(self.show_ep_num, False, False, 0)
|
|
283
|
+
|
|
284
|
+
add_icon = gtk.Image()
|
|
285
|
+
add_icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON)
|
|
286
|
+
self.add_epp_button = gtk.Button()
|
|
287
|
+
self.add_epp_button.set_image(add_icon)
|
|
288
|
+
self.add_epp_button.connect("clicked", self.do_add_epp)
|
|
289
|
+
self.add_epp_button.set_sensitive(False)
|
|
290
|
+
line2.pack_start(self.add_epp_button, False, False, 0)
|
|
277
291
|
|
|
278
292
|
self.play_next_button = gtk.Button('Play Next')
|
|
279
293
|
self.play_next_button.connect("clicked", self.do_play, True)
|
|
@@ -369,7 +383,7 @@ class Trackma_gtk(object):
|
|
|
369
383
|
key, mod = gtk.accelerator_parse("<Control>L")
|
|
370
384
|
mb_scanlibrary.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
371
385
|
key, mod = gtk.accelerator_parse("<Control>W")
|
|
372
|
-
mb_web.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
386
|
+
self.mb_web.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
373
387
|
key, mod = gtk.accelerator_parse("<Control>D")
|
|
374
388
|
self.mb_info.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
375
389
|
key, mod = gtk.accelerator_parse("<Control>Delete")
|
|
@@ -379,12 +393,12 @@ class Trackma_gtk(object):
|
|
|
379
393
|
key, mod = gtk.accelerator_parse("<Control>O")
|
|
380
394
|
self.mb_settings.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
381
395
|
key, mod = gtk.accelerator_parse("<Control>Y")
|
|
382
|
-
mb_copy.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
396
|
+
self.mb_copy.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
383
397
|
key, mod = gtk.accelerator_parse("<Shift>A")
|
|
384
|
-
mb_alt_title.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
398
|
+
self.mb_alt_title.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
385
399
|
key, mod = gtk.accelerator_parse("<Shift>C")
|
|
386
400
|
self.mb_switch_account.add_accelerator("activate", accelgrp, key, mod, gtk.ACCEL_VISIBLE)
|
|
387
|
-
|
|
401
|
+
|
|
388
402
|
self.main.add_accel_group(accelgrp)
|
|
389
403
|
|
|
390
404
|
# Status icon
|
|
@@ -421,6 +435,8 @@ class Trackma_gtk(object):
|
|
|
421
435
|
else:
|
|
422
436
|
self.main.show()
|
|
423
437
|
|
|
438
|
+
self.show_ep_num.hide()
|
|
439
|
+
|
|
424
440
|
self.start_engine()
|
|
425
441
|
|
|
426
442
|
def _clear_gui(self):
|
|
@@ -436,6 +452,8 @@ class Trackma_gtk(object):
|
|
|
436
452
|
self.engine.api_info['name'],
|
|
437
453
|
self.engine.api_info['mediatype']))
|
|
438
454
|
self.api_icon.set_from_file(api_iconfile)
|
|
455
|
+
if self.config['tray_api_icon']:
|
|
456
|
+
self.statusicon.set_from_file(api_iconfile)
|
|
439
457
|
self.api_user.set_text("%s (%s)" % (
|
|
440
458
|
self.engine.get_userconfig('username'),
|
|
441
459
|
self.engine.api_info['mediatype']))
|
|
@@ -452,10 +470,9 @@ class Trackma_gtk(object):
|
|
|
452
470
|
can_play = self.engine.mediainfo['can_play']
|
|
453
471
|
can_update = self.engine.mediainfo['can_update']
|
|
454
472
|
|
|
455
|
-
self.play_button.set_sensitive(can_play)
|
|
456
473
|
self.play_next_button.set_sensitive(can_play)
|
|
457
474
|
|
|
458
|
-
self.
|
|
475
|
+
self.show_ep_button.set_sensitive(can_update)
|
|
459
476
|
self.show_ep_num.set_sensitive(can_update)
|
|
460
477
|
self.add_epp_button.set_sensitive(can_update)
|
|
461
478
|
|
|
@@ -485,11 +502,14 @@ class Trackma_gtk(object):
|
|
|
485
502
|
|
|
486
503
|
self.show_lists[status] = ShowView(
|
|
487
504
|
status,
|
|
488
|
-
self.
|
|
489
|
-
self.
|
|
505
|
+
self.config['colors'],
|
|
506
|
+
self.config['visible_columns'],
|
|
507
|
+
self.score_decimal_places,
|
|
508
|
+
self.config['episodebar_style'])
|
|
490
509
|
self.show_lists[status].get_selection().connect("changed", self.select_show)
|
|
491
510
|
self.show_lists[status].connect("row-activated", self.do_info)
|
|
492
511
|
self.show_lists[status].connect("button-press-event", self.showview_context_menu)
|
|
512
|
+
self.show_lists[status].connect("column-toggled", self._column_toggled)
|
|
493
513
|
self.show_lists[status].pagenumber = self.notebook.get_n_pages()
|
|
494
514
|
sw.add(self.show_lists[status])
|
|
495
515
|
|
|
@@ -499,6 +519,34 @@ class Trackma_gtk(object):
|
|
|
499
519
|
|
|
500
520
|
self.notebook.connect("switch-page", self.select_show)
|
|
501
521
|
|
|
522
|
+
def _column_toggled(self, w, column_name, visible):
|
|
523
|
+
if visible:
|
|
524
|
+
# Make column visible
|
|
525
|
+
self.config['visible_columns'].append(column_name)
|
|
526
|
+
|
|
527
|
+
for view in self.show_lists.itervalues():
|
|
528
|
+
view.cols[column_name].set_visible(True)
|
|
529
|
+
else:
|
|
530
|
+
# Make column invisible
|
|
531
|
+
if len(self.config['visible_columns']) <= 1:
|
|
532
|
+
return # There should be at least 1 column visible
|
|
533
|
+
|
|
534
|
+
self.config['visible_columns'].remove(column_name)
|
|
535
|
+
for view in self.show_lists.itervalues():
|
|
536
|
+
view.cols[column_name].set_visible(False)
|
|
537
|
+
|
|
538
|
+
utils.save_config(self.config, self.configfile)
|
|
539
|
+
|
|
540
|
+
def _show_episode_entry(self, *args):
|
|
541
|
+
self.show_ep_button.hide()
|
|
542
|
+
self.show_ep_num.set_text(self.show_ep_button.get_label())
|
|
543
|
+
self.show_ep_num.show()
|
|
544
|
+
self.show_ep_num.grab_focus()
|
|
545
|
+
|
|
546
|
+
def _hide_episode_entry(self, *args):
|
|
547
|
+
self.show_ep_num.hide()
|
|
548
|
+
self.show_ep_button.show()
|
|
549
|
+
|
|
502
550
|
def idle_destroy(self):
|
|
503
551
|
gobject.idle_add(self.idle_destroy_push)
|
|
504
552
|
|
|
@@ -555,11 +603,22 @@ class Trackma_gtk(object):
|
|
|
555
603
|
return True
|
|
556
604
|
|
|
557
605
|
def do_quit(self, widget=None, event=None, data=None):
|
|
606
|
+
if self.config['remember_geometry']:
|
|
607
|
+
self.do_store_geometry()
|
|
558
608
|
if self.close_thread is None:
|
|
559
609
|
self.close_thread = threading.Thread(target=self.task_unload).start()
|
|
560
610
|
|
|
611
|
+
def do_store_geometry(self):
|
|
612
|
+
(width, height) = self.main.get_size()
|
|
613
|
+
self.config['last_width'] = width
|
|
614
|
+
self.config['last_height'] = height
|
|
615
|
+
utils.save_config(self.config, self.configfile)
|
|
616
|
+
|
|
561
617
|
def do_addsearch(self, widget):
|
|
562
|
-
|
|
618
|
+
page = self.notebook.get_current_page()
|
|
619
|
+
current_status = self.engine.mediainfo['statuses'][page]
|
|
620
|
+
|
|
621
|
+
win = ShowSearch(self.engine, self.config['colors'], current_status)
|
|
563
622
|
win.show_all()
|
|
564
623
|
|
|
565
624
|
def do_settings(self, widget):
|
|
@@ -589,33 +648,28 @@ class Trackma_gtk(object):
|
|
|
589
648
|
win = InfoDialog(self.engine, show)
|
|
590
649
|
|
|
591
650
|
def do_add_epp(self, widget):
|
|
592
|
-
|
|
651
|
+
show = self.engine.get_show_info(self.selected_show)
|
|
593
652
|
try:
|
|
594
|
-
show = self.engine.set_episode(self.selected_show,
|
|
595
|
-
self.show_ep_num.set_value(show['my_progress'])
|
|
653
|
+
show = self.engine.set_episode(self.selected_show, show['my_progress'] + 1)
|
|
596
654
|
except utils.TrackmaError, e:
|
|
597
655
|
self.error(e.message)
|
|
598
656
|
|
|
599
657
|
def do_rem_epp(self, widget):
|
|
600
|
-
|
|
658
|
+
show = self.engine.get_show_info(self.selected_show)
|
|
601
659
|
try:
|
|
602
|
-
|
|
603
|
-
show = self.engine.set_episode(self.selected_show, ep - 1)
|
|
604
|
-
self.show_ep_num.set_value(show['my_progress'])
|
|
605
|
-
|
|
660
|
+
show = self.engine.set_episode(self.selected_show, show['my_progress'] - 1)
|
|
606
661
|
except utils.TrackmaError, e:
|
|
607
662
|
self.error(e.message)
|
|
608
663
|
|
|
609
664
|
def do_update(self, widget):
|
|
610
|
-
self.
|
|
611
|
-
ep = self.show_ep_num.
|
|
665
|
+
self._hide_episode_entry()
|
|
666
|
+
ep = self.show_ep_num.get_text()
|
|
612
667
|
try:
|
|
613
668
|
show = self.engine.set_episode(self.selected_show, ep)
|
|
614
669
|
except utils.TrackmaError, e:
|
|
615
670
|
self.error(e.message)
|
|
616
671
|
|
|
617
672
|
def do_score(self, widget):
|
|
618
|
-
self.show_score.update()
|
|
619
673
|
score = self.show_score.get_value()
|
|
620
674
|
try:
|
|
621
675
|
show = self.engine.set_score(self.selected_show, score)
|
|
@@ -638,6 +692,9 @@ class Trackma_gtk(object):
|
|
|
638
692
|
def changed_show(self, show):
|
|
639
693
|
status = show['my_status']
|
|
640
694
|
self.show_lists[status].update(show)
|
|
695
|
+
if show['id'] == self.selected_show:
|
|
696
|
+
self.show_ep_button.set_label(str(show['my_progress']))
|
|
697
|
+
self.show_score.set_value(show['my_score'])
|
|
641
698
|
|
|
642
699
|
def changed_show_title(self, show, altname):
|
|
643
700
|
status = show['my_status']
|
|
@@ -845,13 +902,8 @@ class Trackma_gtk(object):
|
|
|
845
902
|
self.show_title.set_use_markup(True)
|
|
846
903
|
|
|
847
904
|
# Episode selector
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
else:
|
|
851
|
-
adjustment = gtk.Adjustment(upper=1000, step_incr=1)
|
|
852
|
-
|
|
853
|
-
self.show_ep_num.set_adjustment(adjustment)
|
|
854
|
-
self.show_ep_num.set_value(show['my_progress'])
|
|
905
|
+
self.show_ep_button.set_label(str(show['my_progress']))
|
|
906
|
+
self._hide_episode_entry()
|
|
855
907
|
|
|
856
908
|
# Status selector
|
|
857
909
|
for i in self.statusmodel:
|
|
@@ -865,7 +917,7 @@ class Trackma_gtk(object):
|
|
|
865
917
|
# Image
|
|
866
918
|
if show.get('image_thumb') or show.get('image'):
|
|
867
919
|
utils.make_dir('cache')
|
|
868
|
-
filename = utils.get_filename('cache', "%s.jpg" % (show['id']))
|
|
920
|
+
filename = utils.get_filename('cache', "%s_%s_%s.jpg" % (self.engine.api_info['shortname'], self.engine.api_info['mediatype'], show['id']))
|
|
869
921
|
|
|
870
922
|
if os.path.isfile(filename):
|
|
871
923
|
self.show_image.image_show(filename)
|
|
@@ -946,11 +998,11 @@ class Trackma_gtk(object):
|
|
|
946
998
|
|
|
947
999
|
if self.selected_show or not boolean:
|
|
948
1000
|
if self.engine.mediainfo['can_play']:
|
|
949
|
-
self.play_button.set_sensitive(boolean)
|
|
950
1001
|
self.play_next_button.set_sensitive(boolean)
|
|
1002
|
+
self.mb_play.set_sensitive(boolean)
|
|
951
1003
|
|
|
952
1004
|
if self.engine.mediainfo['can_update']:
|
|
953
|
-
self.
|
|
1005
|
+
self.show_ep_button.set_sensitive(boolean)
|
|
954
1006
|
self.show_ep_num.set_sensitive(boolean)
|
|
955
1007
|
self.add_epp_button.set_sensitive(boolean)
|
|
956
1008
|
self.rem_epp_button.set_sensitive(boolean)
|
|
@@ -958,6 +1010,11 @@ class Trackma_gtk(object):
|
|
|
958
1010
|
self.scoreset_button.set_sensitive(boolean)
|
|
959
1011
|
self.show_score.set_sensitive(boolean)
|
|
960
1012
|
self.statusbox.set_sensitive(boolean)
|
|
1013
|
+
self.mb_copy.set_sensitive(boolean)
|
|
1014
|
+
self.mb_delete.set_sensitive(boolean)
|
|
1015
|
+
self.mb_alt_title.set_sensitive(boolean)
|
|
1016
|
+
self.mb_info.set_sensitive(boolean)
|
|
1017
|
+
self.mb_web.set_sensitive(boolean)
|
|
961
1018
|
|
|
962
1019
|
def do_copytoclip(self, widget):
|
|
963
1020
|
# Copy selected show title to clipboard
|
|
@@ -1129,27 +1186,53 @@ class ImageView(gtk.HBox):
|
|
|
1129
1186
|
self.w_pholder.set_text(msg)
|
|
1130
1187
|
|
|
1131
1188
|
class ShowView(gtk.TreeView):
|
|
1132
|
-
|
|
1189
|
+
__gsignals__ = {'column-toggled': (gobject.SIGNAL_RUN_LAST, \
|
|
1190
|
+
gobject.TYPE_PYOBJECT, (gobject.TYPE_STRING, gobject.TYPE_BOOLEAN) )}
|
|
1191
|
+
|
|
1192
|
+
def __init__(self, status, colors, visible_columns, decimals=0, progress_style=1):
|
|
1133
1193
|
gtk.TreeView.__init__(self)
|
|
1134
1194
|
|
|
1135
|
-
self.
|
|
1195
|
+
self.colors = colors
|
|
1196
|
+
self.visible_columns = visible_columns
|
|
1136
1197
|
self.decimals = decimals
|
|
1137
1198
|
self.status_filter = status
|
|
1199
|
+
self.progress_style = progress_style
|
|
1138
1200
|
|
|
1139
1201
|
self.set_enable_search(True)
|
|
1140
1202
|
self.set_search_column(1)
|
|
1141
1203
|
|
|
1142
1204
|
self.cols = dict()
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1205
|
+
self.available_columns = (
|
|
1206
|
+
('Title', 1),
|
|
1207
|
+
('Progress', 2),
|
|
1208
|
+
('Score', 3),
|
|
1209
|
+
('Percent', 10),
|
|
1210
|
+
('Start', 11),
|
|
1211
|
+
('End', 12),
|
|
1212
|
+
('My start', 13),
|
|
1213
|
+
('My end', 14),
|
|
1214
|
+
)
|
|
1215
|
+
|
|
1216
|
+
for (name, sort) in self.available_columns:
|
|
1149
1217
|
self.cols[name] = gtk.TreeViewColumn(name)
|
|
1150
1218
|
self.cols[name].set_sort_column_id(sort)
|
|
1219
|
+
|
|
1220
|
+
# This is a hack to allow for right-clickable header
|
|
1221
|
+
label = gtk.Label(name)
|
|
1222
|
+
label.show()
|
|
1223
|
+
self.cols[name].set_widget(label)
|
|
1224
|
+
|
|
1151
1225
|
self.append_column(self.cols[name])
|
|
1152
1226
|
|
|
1227
|
+
w = self.cols[name].get_widget()
|
|
1228
|
+
while not isinstance(w, gtk.Button):
|
|
1229
|
+
w = w.get_parent()
|
|
1230
|
+
|
|
1231
|
+
w.connect('button-release-event', self._header_button_release)
|
|
1232
|
+
|
|
1233
|
+
if name not in self.visible_columns:
|
|
1234
|
+
self.cols[name].set_visible(False)
|
|
1235
|
+
|
|
1153
1236
|
#renderer_id = gtk.CellRendererText()
|
|
1154
1237
|
#self.cols['ID'].pack_start(renderer_id, False)
|
|
1155
1238
|
#self.cols['ID'].set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
|
|
@@ -1162,43 +1245,82 @@ class ShowView(gtk.TreeView):
|
|
|
1162
1245
|
self.cols['Title'].set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
|
1163
1246
|
self.cols['Title'].set_expand(True)
|
|
1164
1247
|
self.cols['Title'].add_attribute(renderer_title, 'text', 1)
|
|
1165
|
-
self.cols['Title'].add_attribute(renderer_title, 'foreground', 9)
|
|
1248
|
+
self.cols['Title'].add_attribute(renderer_title, 'foreground', 9) # Using foreground-gdk does not work, possibly due to the timing of it being set
|
|
1166
1249
|
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
self.cols['Progress'].set_expand(False)
|
|
1250
|
+
renderer_progress = gtk.CellRendererText()
|
|
1251
|
+
self.cols['Progress'].pack_start(renderer_progress, False)
|
|
1252
|
+
self.cols['Progress'].add_attribute(renderer_progress, 'text', 4)
|
|
1253
|
+
self.cols['Progress'].set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
|
|
1254
|
+
self.cols['Progress'].set_expand(False)
|
|
1173
1255
|
|
|
1174
|
-
|
|
1175
|
-
renderer_percent =
|
|
1256
|
+
if self.progress_style == 0:
|
|
1257
|
+
renderer_percent = gtk.CellRendererProgress()
|
|
1258
|
+
self.cols['Percent'].pack_start(renderer_percent, False)
|
|
1259
|
+
self.cols['Percent'].add_attribute(renderer_percent, 'value', 10)
|
|
1260
|
+
else:
|
|
1261
|
+
renderer_percent = ProgressCellRenderer(self.colors)
|
|
1176
1262
|
self.cols['Percent'].pack_start(renderer_percent, False)
|
|
1177
1263
|
self.cols['Percent'].add_attribute(renderer_percent, 'value', 2)
|
|
1178
1264
|
self.cols['Percent'].add_attribute(renderer_percent, 'total', 6)
|
|
1179
1265
|
self.cols['Percent'].add_attribute(renderer_percent, 'subvalue', 7)
|
|
1180
1266
|
self.cols['Percent'].add_attribute(renderer_percent, 'eps', 8)
|
|
1181
|
-
|
|
1267
|
+
renderer_percent.set_fixed_size(100, -1)
|
|
1268
|
+
|
|
1269
|
+
renderer = gtk.CellRendererText()
|
|
1270
|
+
self.cols['Score'].pack_start(renderer, False)
|
|
1271
|
+
self.cols['Score'].add_attribute(renderer, 'text', 5)
|
|
1272
|
+
renderer = gtk.CellRendererText()
|
|
1273
|
+
self.cols['Start'].pack_start(renderer, False)
|
|
1274
|
+
self.cols['Start'].add_attribute(renderer, 'text', 11)
|
|
1275
|
+
renderer = gtk.CellRendererText()
|
|
1276
|
+
self.cols['End'].pack_start(renderer, False)
|
|
1277
|
+
self.cols['End'].add_attribute(renderer, 'text', 12)
|
|
1278
|
+
renderer = gtk.CellRendererText()
|
|
1279
|
+
self.cols['My start'].pack_start(renderer, False)
|
|
1280
|
+
self.cols['My start'].add_attribute(renderer, 'text', 13)
|
|
1281
|
+
renderer = gtk.CellRendererText()
|
|
1282
|
+
self.cols['My end'].pack_start(renderer, False)
|
|
1283
|
+
self.cols['My end'].add_attribute(renderer, 'text', 14)
|
|
1284
|
+
|
|
1285
|
+
# ID, Title, Episodes, Score, Episodes_str, Score_str, Total, Subvalue, Eps, Color, Progress%, start_date, end_date, my_start_date, my_finish_date
|
|
1286
|
+
self.store = gtk.ListStore(str, str, int, float, str, str, int, int, gobject.TYPE_PYOBJECT, str, int, str, str, str, str)
|
|
1287
|
+
self.set_model(self.store)
|
|
1182
1288
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1289
|
+
def _header_button_release(self, button, event):
|
|
1290
|
+
if event.button == 3:
|
|
1291
|
+
menu = gtk.Menu()
|
|
1292
|
+
for name, sort in self.available_columns:
|
|
1293
|
+
is_active = name in self.visible_columns
|
|
1188
1294
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1295
|
+
item = gtk.CheckMenuItem(name)
|
|
1296
|
+
item.set_active(is_active)
|
|
1297
|
+
item.connect('activate', self._header_menu_item, name, not is_active)
|
|
1298
|
+
menu.append(item)
|
|
1299
|
+
item.show()
|
|
1300
|
+
|
|
1301
|
+
menu.popup(None, None, None, event.button, event.time)
|
|
1302
|
+
|
|
1303
|
+
def _header_menu_item(self, w, column_name, visible):
|
|
1304
|
+
self.emit('column-toggled', column_name, visible)
|
|
1305
|
+
|
|
1306
|
+
def _format_date(self, date):
|
|
1307
|
+
if date:
|
|
1308
|
+
try:
|
|
1309
|
+
return date.strftime('%Y-%m-%d')
|
|
1310
|
+
except ValueError:
|
|
1311
|
+
return '?'
|
|
1312
|
+
else:
|
|
1313
|
+
return '-'
|
|
1192
1314
|
|
|
1193
1315
|
def _get_color(self, show, eps):
|
|
1194
1316
|
if show.get('queued'):
|
|
1195
|
-
return '
|
|
1317
|
+
return str(getColor(self.colors['is_queued']))
|
|
1196
1318
|
elif eps and max(eps) > show['my_progress']:
|
|
1197
|
-
return '
|
|
1319
|
+
return str(getColor(self.colors['new_episode']))
|
|
1198
1320
|
elif show['status'] == utils.STATUS_AIRING:
|
|
1199
|
-
return '
|
|
1321
|
+
return str(getColor(self.colors['is_airing']))
|
|
1200
1322
|
elif show['status'] == utils.STATUS_NOTYET:
|
|
1201
|
-
return '
|
|
1323
|
+
return str(getColor(self.colors['not_aired']))
|
|
1202
1324
|
else:
|
|
1203
1325
|
return None
|
|
1204
1326
|
|
|
@@ -1207,10 +1329,11 @@ class ShowView(gtk.TreeView):
|
|
|
1207
1329
|
self.store.clear()
|
|
1208
1330
|
|
|
1209
1331
|
def append(self, show, altname=None, eps=None):
|
|
1210
|
-
|
|
1211
|
-
|
|
1332
|
+
episodes_str = "%d / %d" % (show['my_progress'], show['total'])
|
|
1333
|
+
if show['total'] and show['my_progress'] <= show['total']:
|
|
1334
|
+
progress = (float(show['my_progress']) / show['total']) * 100
|
|
1212
1335
|
else:
|
|
1213
|
-
|
|
1336
|
+
progress = 0
|
|
1214
1337
|
|
|
1215
1338
|
title_str = show['title']
|
|
1216
1339
|
if altname:
|
|
@@ -1226,6 +1349,11 @@ class ShowView(gtk.TreeView):
|
|
|
1226
1349
|
else:
|
|
1227
1350
|
available_eps = []
|
|
1228
1351
|
|
|
1352
|
+
start_date = self._format_date(show['start_date'])
|
|
1353
|
+
end_date = self._format_date(show['end_date'])
|
|
1354
|
+
my_start_date = self._format_date(show['my_start_date'])
|
|
1355
|
+
my_finish_date = self._format_date(show['my_finish_date'])
|
|
1356
|
+
|
|
1229
1357
|
row = [show['id'],
|
|
1230
1358
|
title_str,
|
|
1231
1359
|
show['my_progress'],
|
|
@@ -1235,7 +1363,12 @@ class ShowView(gtk.TreeView):
|
|
|
1235
1363
|
show['total'],
|
|
1236
1364
|
aired_eps,
|
|
1237
1365
|
available_eps,
|
|
1238
|
-
self._get_color(show, available_eps)
|
|
1366
|
+
self._get_color(show, available_eps),
|
|
1367
|
+
progress,
|
|
1368
|
+
start_date,
|
|
1369
|
+
end_date,
|
|
1370
|
+
my_start_date,
|
|
1371
|
+
my_finish_date]
|
|
1239
1372
|
self.store.append(row)
|
|
1240
1373
|
|
|
1241
1374
|
def append_finish(self):
|
|
@@ -1252,10 +1385,9 @@ class ShowView(gtk.TreeView):
|
|
|
1252
1385
|
def update(self, show):
|
|
1253
1386
|
for row in self.store:
|
|
1254
1387
|
if int(row[0]) == show['id']:
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
row[4] = episodes_str
|
|
1388
|
+
episodes_str = "%d / %d" % (show['my_progress'], show['total'])
|
|
1389
|
+
row[2] = show['my_progress']
|
|
1390
|
+
row[4] = episodes_str
|
|
1259
1391
|
|
|
1260
1392
|
score_str = "%0.*f" % (self.decimals, show['my_score'])
|
|
1261
1393
|
|
|
@@ -1282,7 +1414,7 @@ class ShowView(gtk.TreeView):
|
|
|
1282
1414
|
for row in self.store:
|
|
1283
1415
|
if int(row[0]) == show['id']:
|
|
1284
1416
|
if is_playing:
|
|
1285
|
-
row[9] = '
|
|
1417
|
+
row[9] = getColor(self.colors['is_playing'])
|
|
1286
1418
|
else:
|
|
1287
1419
|
row[9] = self._get_color(show, row[8])
|
|
1288
1420
|
return
|
|
@@ -1561,6 +1693,8 @@ class InfoWidget(gtk.VBox):
|
|
|
1561
1693
|
|
|
1562
1694
|
# Load image
|
|
1563
1695
|
imagefile = utils.get_filename('cache', "f_%d.jpg" % show['id'])
|
|
1696
|
+
imagefile = utils.get_filename('cache', "%s_%s_f_%s.jpg" % (self.engine.api_info['shortname'], self.engine.api_info['mediatype'], show['id']))
|
|
1697
|
+
|
|
1564
1698
|
|
|
1565
1699
|
if os.path.isfile(imagefile):
|
|
1566
1700
|
self.w_image.image_show(imagefile)
|
|
@@ -1780,6 +1914,20 @@ class Settings(gtk.Window):
|
|
|
1780
1914
|
line5.pack_start(line_autosend_size, False, False, 0)
|
|
1781
1915
|
line5.pack_start(self.rbtn_autosend_at_exit, False, False, 0)
|
|
1782
1916
|
|
|
1917
|
+
### Additional options
|
|
1918
|
+
header_additional = gtk.Label()
|
|
1919
|
+
header_additional.set_text('<span size="10000"><b>Additional options</b></span>')
|
|
1920
|
+
header_additional.set_use_markup(True)
|
|
1921
|
+
|
|
1922
|
+
self.chk_auto_status_change = gtk.CheckButton('Change status automatically')
|
|
1923
|
+
self.chk_auto_status_change_if_scored = gtk.CheckButton('Change status automatically only if scored')
|
|
1924
|
+
self.chk_auto_status_change_if_scored.set_sensitive(False)
|
|
1925
|
+
self.chk_auto_status_change.connect("toggled", self.radio_toggled, self.chk_auto_status_change_if_scored)
|
|
1926
|
+
self.chk_auto_date_change = gtk.CheckButton('Change start and finish dates automatically')
|
|
1927
|
+
line_additional = gtk.VBox(False, 5)
|
|
1928
|
+
line_additional.pack_start(self.chk_auto_status_change, False, False, 0)
|
|
1929
|
+
line_additional.pack_start(self.chk_auto_status_change_if_scored, False, False, 0)
|
|
1930
|
+
line_additional.pack_start(self.chk_auto_date_change, False, False, 0)
|
|
1783
1931
|
|
|
1784
1932
|
### GTK Interface ###
|
|
1785
1933
|
header4 = gtk.Label()
|
|
@@ -1789,14 +1937,58 @@ class Settings(gtk.Window):
|
|
|
1789
1937
|
self.chk_show_tray = gtk.CheckButton('Show Tray Icon')
|
|
1790
1938
|
self.chk_close_to_tray = gtk.CheckButton('Close to Tray')
|
|
1791
1939
|
self.chk_start_in_tray = gtk.CheckButton('Start Minimized to Tray')
|
|
1940
|
+
self.chk_tray_api_icon = gtk.CheckButton('Use API Icon in Tray')
|
|
1941
|
+
self.chk_remember_geometry = gtk.CheckButton('Remember Window Geometry')
|
|
1942
|
+
self.chk_classic_progress = gtk.CheckButton('Use Classic Progress Bar')
|
|
1792
1943
|
self.chk_close_to_tray.set_sensitive(False)
|
|
1793
1944
|
self.chk_start_in_tray.set_sensitive(False)
|
|
1945
|
+
self.chk_tray_api_icon.set_sensitive(False)
|
|
1794
1946
|
self.chk_show_tray.connect("toggled", self.radio_toggled, self.chk_close_to_tray)
|
|
1795
1947
|
self.chk_show_tray.connect("toggled", self.radio_toggled, self.chk_start_in_tray)
|
|
1948
|
+
self.chk_show_tray.connect("toggled", self.radio_toggled, self.chk_tray_api_icon)
|
|
1796
1949
|
line6 = gtk.VBox(False, 5)
|
|
1797
1950
|
line6.pack_start(self.chk_show_tray, False, False, 0)
|
|
1798
1951
|
line6.pack_start(self.chk_close_to_tray, False, False, 0)
|
|
1799
1952
|
line6.pack_start(self.chk_start_in_tray, False, False, 0)
|
|
1953
|
+
line6.pack_start(self.chk_tray_api_icon, False, False, 0)
|
|
1954
|
+
line6.pack_start(self.chk_remember_geometry, False, False, 0)
|
|
1955
|
+
line6.pack_start(self.chk_classic_progress, False, False, 0)
|
|
1956
|
+
|
|
1957
|
+
### Colors ###
|
|
1958
|
+
header5 = gtk.Label()
|
|
1959
|
+
header5.set_text('<span size="10000"><b>Color Scheme</b></span>')
|
|
1960
|
+
header5.set_use_markup(True)
|
|
1961
|
+
self.colors = {}
|
|
1962
|
+
pages = [('rows', 'Row text'),
|
|
1963
|
+
('progress','Progress widget')]
|
|
1964
|
+
|
|
1965
|
+
self.colors['rows'] = [('is_playing', 'Playing'),
|
|
1966
|
+
('is_queued', 'Queued'),
|
|
1967
|
+
('new_episode', 'New Episode'),
|
|
1968
|
+
('is_airing', 'Airing'),
|
|
1969
|
+
('not_aired', 'Unaired')]
|
|
1970
|
+
self.colors['progress'] = [('progress_bg', 'Background'),
|
|
1971
|
+
('progress_fg', 'Watched bar'),
|
|
1972
|
+
('progress_sub_bg', 'Aired episodes'),
|
|
1973
|
+
('progress_sub_fg', 'Stored episodes'),
|
|
1974
|
+
('progress_complete', 'Complete')]
|
|
1975
|
+
self.col_pickers = {}
|
|
1976
|
+
|
|
1977
|
+
col_notebook = gtk.Notebook()
|
|
1978
|
+
for (key,tab_title) in pages:
|
|
1979
|
+
rows = gtk.VBox(False, 10)
|
|
1980
|
+
rows_lines = []
|
|
1981
|
+
for (c_key,text) in self.colors[key]: # Generate widgets for each color
|
|
1982
|
+
line = gtk.HBox(False, 5)
|
|
1983
|
+
label = gtk.Label(text)
|
|
1984
|
+
picker = gtk.ColorButton(getColor(self.config['colors'][c_key]))
|
|
1985
|
+
self.col_pickers[c_key] = picker
|
|
1986
|
+
line.pack_start(label)
|
|
1987
|
+
line.pack_end(picker, False, False, 0)
|
|
1988
|
+
rows.pack_start(line, False, False, 0)
|
|
1989
|
+
rows_lines.append(line)
|
|
1990
|
+
col_notebook.append_page(rows, gtk.Label(tab_title))
|
|
1991
|
+
|
|
1800
1992
|
|
|
1801
1993
|
# Join HBoxes
|
|
1802
1994
|
mainbox = gtk.VBox(False, 10)
|
|
@@ -1820,11 +2012,15 @@ class Settings(gtk.Window):
|
|
|
1820
2012
|
page1.pack_start(line4, False, False, 0)
|
|
1821
2013
|
page1.pack_start(header3, False, False, 0)
|
|
1822
2014
|
page1.pack_start(line5, False, False, 0)
|
|
2015
|
+
page1.pack_start(header_additional, False, False, 0)
|
|
2016
|
+
page1.pack_start(line_additional, False, False, 0)
|
|
1823
2017
|
|
|
1824
2018
|
page2 = gtk.VBox(False, 10)
|
|
1825
2019
|
page2.set_border_width(5)
|
|
1826
2020
|
page2.pack_start(header4, False, False, 0)
|
|
1827
2021
|
page2.pack_start(line6, False, False, 0)
|
|
2022
|
+
page2.pack_start(header5, False, False, 0)
|
|
2023
|
+
page2.pack_start(col_notebook, False, False, 0)
|
|
1828
2024
|
|
|
1829
2025
|
notebook.append_page(page0, gtk.Label('Media'))
|
|
1830
2026
|
notebook.append_page(page1, gtk.Label('Sync'))
|
|
@@ -1872,10 +2068,17 @@ class Settings(gtk.Window):
|
|
|
1872
2068
|
self.spin_autosend_hours.set_value(self.engine.get_config('autosend_hours'))
|
|
1873
2069
|
self.spin_autosend_size.set_value(self.engine.get_config('autosend_size'))
|
|
1874
2070
|
|
|
2071
|
+
self.chk_auto_status_change.set_active(self.engine.get_config('auto_status_change'))
|
|
2072
|
+
self.chk_auto_status_change_if_scored.set_active(self.engine.get_config('auto_status_change_if_scored'))
|
|
2073
|
+
self.chk_auto_date_change.set_active(self.engine.get_config('auto_date_change'))
|
|
2074
|
+
|
|
1875
2075
|
"""GTK Interface Configuration"""
|
|
1876
2076
|
self.chk_show_tray.set_active(self.config['show_tray'])
|
|
1877
2077
|
self.chk_close_to_tray.set_active(self.config['close_to_tray'])
|
|
1878
2078
|
self.chk_start_in_tray.set_active(self.config['start_in_tray'])
|
|
2079
|
+
self.chk_tray_api_icon.set_active(self.config['tray_api_icon'])
|
|
2080
|
+
self.chk_remember_geometry.set_active(self.config['remember_geometry'])
|
|
2081
|
+
self.chk_classic_progress.set_active(not self.config['episodebar_style'])
|
|
1879
2082
|
|
|
1880
2083
|
def save_config(self):
|
|
1881
2084
|
"""Engine Configuration"""
|
|
@@ -1918,6 +2121,9 @@ class Settings(gtk.Window):
|
|
|
1918
2121
|
self.engine.set_config('autosend_hours', self.spin_autosend_hours.get_value_as_int())
|
|
1919
2122
|
self.engine.set_config('autosend_size', self.spin_autosend_size.get_value_as_int())
|
|
1920
2123
|
|
|
2124
|
+
self.engine.set_config('auto_status_change', self.chk_auto_status_change.get_active())
|
|
2125
|
+
self.engine.set_config('auto_status_change_if_scored', self.chk_auto_status_change_if_scored.get_active())
|
|
2126
|
+
self.engine.set_config('auto_date_change', self.chk_auto_date_change.get_active())
|
|
1921
2127
|
self.engine.save_config()
|
|
1922
2128
|
|
|
1923
2129
|
"""GTK Interface configuration"""
|
|
@@ -1926,9 +2132,17 @@ class Settings(gtk.Window):
|
|
|
1926
2132
|
if self.chk_show_tray.get_active():
|
|
1927
2133
|
self.config['close_to_tray'] = self.chk_close_to_tray.get_active()
|
|
1928
2134
|
self.config['start_in_tray'] = self.chk_start_in_tray.get_active()
|
|
2135
|
+
self.config['tray_api_icon'] = self.chk_tray_api_icon.get_active()
|
|
1929
2136
|
else:
|
|
1930
2137
|
self.config['close_to_tray'] = False
|
|
1931
2138
|
self.config['start_in_tray'] = False
|
|
2139
|
+
self.config['tray_api_icon'] = False
|
|
2140
|
+
|
|
2141
|
+
self.config['remember_geometry'] = self.chk_remember_geometry.get_active()
|
|
2142
|
+
self.config['episodebar_style'] = int(not self.chk_classic_progress.get_active())
|
|
2143
|
+
|
|
2144
|
+
"""Update Colors"""
|
|
2145
|
+
self.config['colors'] = {key: str(col.get_color()) for key,col in self.col_pickers.items()}
|
|
1932
2146
|
|
|
1933
2147
|
utils.save_config(self.config, self.configfile)
|
|
1934
2148
|
|
|
@@ -2078,10 +2292,11 @@ class AccountSelectAdd(gtk.Window):
|
|
|
2078
2292
|
|
|
2079
2293
|
|
|
2080
2294
|
class ShowSearch(gtk.Window):
|
|
2081
|
-
def __init__(self, engine):
|
|
2295
|
+
def __init__(self, engine, colors, current_status):
|
|
2082
2296
|
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
|
|
2083
2297
|
|
|
2084
2298
|
self.engine = engine
|
|
2299
|
+
self.current_status = current_status
|
|
2085
2300
|
|
|
2086
2301
|
fullbox = gtk.HPaned()
|
|
2087
2302
|
|
|
@@ -2116,7 +2331,7 @@ class ShowSearch(gtk.Window):
|
|
|
2116
2331
|
bottombar.pack_start(close_button, False, False, 0)
|
|
2117
2332
|
alignment.add(bottombar)
|
|
2118
2333
|
|
|
2119
|
-
self.showlist = ShowSearchView()
|
|
2334
|
+
self.showlist = ShowSearchView(colors)
|
|
2120
2335
|
self.showlist.get_selection().connect("changed", self.select_show)
|
|
2121
2336
|
|
|
2122
2337
|
sw.add(self.showlist)
|
|
@@ -2141,7 +2356,7 @@ class ShowSearch(gtk.Window):
|
|
|
2141
2356
|
|
|
2142
2357
|
if show is not None:
|
|
2143
2358
|
try:
|
|
2144
|
-
self.engine.add_show(show)
|
|
2359
|
+
self.engine.add_show(show, self.current_status)
|
|
2145
2360
|
#self.do_close()
|
|
2146
2361
|
except utils.TrackmaError, e:
|
|
2147
2362
|
self.error_push(e.message)
|
|
@@ -2156,7 +2371,7 @@ class ShowSearch(gtk.Window):
|
|
|
2156
2371
|
# Get selected show ID
|
|
2157
2372
|
(tree_model, tree_iter) = widget.get_selected()
|
|
2158
2373
|
if not tree_iter:
|
|
2159
|
-
self.allow_buttons_push(False, lists_too=False)
|
|
2374
|
+
self.allow_buttons_push(False) # (False, lists_too=False)
|
|
2160
2375
|
return
|
|
2161
2376
|
|
|
2162
2377
|
self.selected_show = int(tree_model.get(tree_iter, 0)[0])
|
|
@@ -2206,7 +2421,7 @@ class ShowSearch(gtk.Window):
|
|
|
2206
2421
|
|
|
2207
2422
|
|
|
2208
2423
|
class ShowSearchView(gtk.TreeView):
|
|
2209
|
-
def __init__(self):
|
|
2424
|
+
def __init__(self, colors):
|
|
2210
2425
|
gtk.TreeView.__init__(self)
|
|
2211
2426
|
|
|
2212
2427
|
self.cols = dict()
|
|
@@ -2239,15 +2454,17 @@ class ShowSearchView(gtk.TreeView):
|
|
|
2239
2454
|
self.store = gtk.ListStore(str, str, str, str, str)
|
|
2240
2455
|
self.set_model(self.store)
|
|
2241
2456
|
|
|
2457
|
+
self.colors = colors
|
|
2458
|
+
|
|
2242
2459
|
def append_start(self):
|
|
2243
2460
|
self.freeze_child_notify()
|
|
2244
2461
|
self.store.clear()
|
|
2245
2462
|
|
|
2246
2463
|
def append(self, show):
|
|
2247
2464
|
if show['status'] == 1:
|
|
2248
|
-
color = '
|
|
2465
|
+
color = str(getColor(self.colors['is_airing']))
|
|
2249
2466
|
elif show['status'] == 3:
|
|
2250
|
-
color = '
|
|
2467
|
+
color = str(getColor(self.colors['not_aired']))
|
|
2251
2468
|
else:
|
|
2252
2469
|
color = None
|
|
2253
2470
|
|
|
@@ -2282,8 +2499,9 @@ class ProgressCellRenderer(gtk.GenericCellRenderer):
|
|
|
2282
2499
|
"Available episodes", gobject.PARAM_READWRITE),
|
|
2283
2500
|
}
|
|
2284
2501
|
|
|
2285
|
-
def __init__(self):
|
|
2502
|
+
def __init__(self, colors):
|
|
2286
2503
|
self.__gobject_init__()
|
|
2504
|
+
self.colors = colors
|
|
2287
2505
|
self.value = self.get_property("value")
|
|
2288
2506
|
self.subvalue = self.get_property("subvalue")
|
|
2289
2507
|
self.total = self.get_property("total")
|
|
@@ -2299,7 +2517,7 @@ class ProgressCellRenderer(gtk.GenericCellRenderer):
|
|
|
2299
2517
|
cr = window.cairo_create()
|
|
2300
2518
|
(x, y, w, h) = self.on_get_size(widget, cell_area)
|
|
2301
2519
|
|
|
2302
|
-
cr.set_source_rgb(0.9, 0.9, 0.9)
|
|
2520
|
+
cr.set_source_color(getColor(self.colors['progress_bg'])) #set_source_rgb(0.9, 0.9, 0.9)
|
|
2303
2521
|
cr.rectangle(x, y, w, h)
|
|
2304
2522
|
cr.fill()
|
|
2305
2523
|
|
|
@@ -2312,22 +2530,22 @@ class ProgressCellRenderer(gtk.GenericCellRenderer):
|
|
|
2312
2530
|
else:
|
|
2313
2531
|
mid = int(w / float(self.total) * self.subvalue)
|
|
2314
2532
|
|
|
2315
|
-
cr.set_source_rgb(0.7, 0.7, 0.7)
|
|
2533
|
+
cr.set_source_color(getColor(self.colors['progress_sub_bg'])) #set_source_rgb(0.7, 0.7, 0.7)
|
|
2316
2534
|
cr.rectangle(x, y+h-self._subheight, mid, h-(h-self._subheight))
|
|
2317
2535
|
cr.fill()
|
|
2318
2536
|
|
|
2319
2537
|
if self.value:
|
|
2320
2538
|
if self.value >= self.total:
|
|
2321
|
-
cr.set_source_rgb(0.6, 0.8, 0.7)
|
|
2539
|
+
cr.set_source_color(getColor(self.colors['progress_complete'])) #set_source_rgb(0.6, 0.8, 0.7)
|
|
2322
2540
|
cr.rectangle(x, y, w, h)
|
|
2323
2541
|
else:
|
|
2324
2542
|
mid = int(w / float(self.total) * self.value)
|
|
2325
|
-
cr.set_source_rgb(0.6, 0.7, 0.8)
|
|
2543
|
+
cr.set_source_color(getColor(self.colors['progress_fg'])) #set_source_rgb(0.6, 0.7, 0.8)
|
|
2326
2544
|
cr.rectangle(x, y, mid, h)
|
|
2327
2545
|
cr.fill()
|
|
2328
2546
|
|
|
2329
2547
|
if self.eps:
|
|
2330
|
-
cr.set_source_rgb(0.4, 0.5, 0.6)
|
|
2548
|
+
cr.set_source_color(getColor(self.colors['progress_sub_fg'])) #set_source_rgb(0.4, 0.5, 0.6)
|
|
2331
2549
|
for episode in self.eps:
|
|
2332
2550
|
if episode > 0 and episode <= self.total:
|
|
2333
2551
|
start = int(w / float(self.total) * (episode - 1))
|
|
@@ -2344,6 +2562,19 @@ class ProgressCellRenderer(gtk.GenericCellRenderer):
|
|
|
2344
2562
|
h = cell_area.height
|
|
2345
2563
|
return (x, y, w, h)
|
|
2346
2564
|
|
|
2565
|
+
def getColor(colorString):
|
|
2566
|
+
# Takes a color string in either #RRGGBB format TODO: or group,role format (using GTK int values)
|
|
2567
|
+
# Returns gdk color
|
|
2568
|
+
if colorString[0] == "#":
|
|
2569
|
+
return gtk.gdk.color_parse(colorString)
|
|
2570
|
+
#else:
|
|
2571
|
+
#(group, role) = [int(i) for i in colorString.split(',')]
|
|
2572
|
+
#if (0 <= group <= 2) and (0 <= role <= 19):
|
|
2573
|
+
#return QtGui.QColor( QPalette().color(group, role) )
|
|
2574
|
+
#else:
|
|
2575
|
+
## Failsafe - return black
|
|
2576
|
+
#return QtGui.QColor()
|
|
2577
|
+
|
|
2347
2578
|
def main():
|
|
2348
2579
|
app = Trackma_gtk()
|
|
2349
2580
|
try:
|