Code by Scott שאול בן ישוע
CastPodderGui.py 160 KB
Newer Older
Sha'ul ben Yeshua's avatar
Sha'ul ben Yeshua committed
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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
289
290
291
292
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
#
# Copyright (c) 2005-2006 Scott Grayban and the CastPodder Team
#
# $Id: CastPodderGui.py 151 2006-11-07 08:40:38Z sgrayban $

"""
CastPodder is Copright © 2005-2006 Scott Grayban
Read the file Software_License_Agreement.txt for more info.

"""
__license__ = "Commercial"

#Version check
CHECK_VERSION = 5.5

# SetDonateNDaysAhead holds the popup stuff

# Not used anymore since everything is compiled into the new compiler
#
# Multislot wxPython patch from gentoo dev
# http://bugs.gentoo.org/show_bug.cgi?id=109116
#import wxversion	
#wxversion.ensureMinimal('2.6')
# ensures the wx is atleast 2.6

import wx
import wx.xrc as xrc
import wx.lib.filebrowsebutton as filebrowse
import wx.lib.ClickableHtmlWindow
import time
import threading
import os
import shutil
import urllib
import urlparse
import pickle, bsddb.db, bsddb.dbshelve
import logging, logging.handlers
import inspect
import os.path
from   localization import LanguageModule
from   localization import catalog
import stat
from   xml.dom.minidom import parseString
from   wxPython.wx import *
import gui.iPodderWindows
import StringIO

# Parts of iPodder
from   ipodder import core
from   ipodder import conlogging
from   gui import scheduler
from   ipodder import conlogging
from   ipodder.configuration import *
from   ipodder import feeds
from   ipodder import state as statemodule
from   ipodder import players
from   ipodder import hooks
from   ipodder import misc
from   ipodder import grabbers
import gui, gui.images, gui.tree
import gui.scheduler as scheduler
from   gui import OptionsDialog
from   gui import clipboard
# from   ipodder.tagging import editTags

# Third-party parts of iPodder
from ipodder.contrib import feedparser
from ipodder.contrib import GenericDispatch

if sys.version_info[0] == 2 and sys.version_info[1] <= 3:
    import webbrowser
else:
    from ipodder.contrib import webbrowser

# Skinning
from gui.skin import \
    STRIPE_EVEN_COLOR,\
    STRIPE_ODD_COLOR, \
    PRODUCT_NAME, \
    CURRENT_VERSION_URL, \
    SPLASH_LIFETIME, \
    SPLASH_DESTROY, \
    CLEANUP_FG, \
    CLEANUP_BG

from gui import skin


#Debug params - Edit me
DEBUG = True
TIMER_INTERVAL = 10000

#GUI params -- Don't edit me.
ID_EXIT = 101
ID_CHECKNOW = 102
ID_OPEN = 103
ID_MAC_EXIT = 104
ID_HIDE = 105
ID_PREFERENCES = 106
ID_SCHEDULER = 107
ID_ABOUT = 108
ID_DONATE = 109
DOWNLOADS_INDEX = 0
SUBSCRIPTIONS_INDEX = 1
DIRECTORY_INDEX = 2
CLEANUP_INDEX = 3
LOGPAGE_INDEX = 4
MAX_DOWNLOADS_DISPLAY = 500

#This needs to be kept in sync with the "Repeat every"
#pulldown on the Scheduler tab.
INTERVAL_HOURS = [12.0,8.0,4.0,2.0,1.5,1.0,.5]

log = logging.getLogger('iPodder')
SPAM = logging.DEBUG / 2

def trimurl(url): 
    method, site, path, query, ign2 = urlparse.urlsplit(url)
    sitesplit = site.split('.')
    if len(sitesplit) and sitesplit[0].startswith('www'): 
        site = '.'.join(sitesplit[1:])
    trimmed = "%s%s" % (site, path)
    if len(query) > 0:
        trimmed += "?%s" % query
    return trimmed

class iPodderCancel(threading.Thread):
    def __init__(self,caller,encinfos_to_cancel):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.caller = caller
        self.encinfos_to_cancel = encinfos_to_cancel

    def run(self):
        self.caller.ipodder.cancel_scan()
        if len(self.encinfos_to_cancel) > 0:
            self.caller.ipodder.cancel(self.encinfos_to_cancel)
        self.caller.CancelThreadComplete(self,self.encinfos_to_cancel)

class iPodderFeedDownload(threading.Thread):
    def __init__(self,caller,feedinfo):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.caller = caller
        self.feedinfo = feedinfo
        
    def run(self):
        enclosures = []
        fsj = core.FeedScanningJob(None, self.feedinfo, enclosures, self.caller.ipodder.state)
        fsj.m_ipodder = self.m_ipodder
        fsj.m_frame = self.m_frame
        fsj.hooks.add('autherror',self.caller.FeedDownloadAuthError)
        fsj.run()
        self.caller.FeedDownloadThreadComplete(self,enclosures,self.feedinfo)
    
class iPodderDownload(threading.Thread):
    def __init__(self,caller,mask=None,catchup=0):
        threading.Thread.__init__(self)
        self.caller = caller
        self.mask = mask
        self.catchup = catchup
    def run(self):
        if "Win" in platform.system():
            import pythoncom
            pythoncom.CoInitialize()

        self.caller.ipodder.start(self.caller.progress,self.mask,self.catchup)
        self.caller.DownloadThreadComplete(self,self.mask)
        
        if "Win" in platform.system():
            pythoncom.CoUninitialize()

class MySplashScreen(wx.SplashScreen):
    def __init__(self,basepath,parent):
        bmp = wx.Image(os.path.join(basepath,"images","splashscreen.bmp")).ConvertToBitmap()
        wx.SplashScreen.__init__(self, bmp,
                                 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                                 SPLASH_LIFETIME, parent, -1)
        #calling routine may destroy me when ready to show main app.


class MyLogWindowHandler(logging.Handler):
    def __init__(self,gui):
        logging.Handler.__init__(self)
        self.gui = gui

    def emit(self,record):

        if record.levelno >= logging.ERROR: 
            self.gui.showlogpage(True)
        self.gui.ThreadSafeDispatch(self.gui.AppendLogWindow, record)
        
    def flush(self):
        self.gui.ThreadSafeDispatch(self.gui.ClearLogWindow)
        
class iPodderStatusBar(wx.StatusBar):
    def __init__(self, parent, log):
        wx.StatusBar.__init__(self, parent, -1)

        self.SetFieldsCount(2)
        self.SetStatusWidths([-2, 130])
        self.log = log
        self.sizeChanged = False
        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.g1 = wx.Gauge(self, -1, 100, (self.GetRect()[2]-125, 16), (105, 15))
        self.g1.SetBezelFace(1)
        self.g1.SetShadowWidth(1)
                
        #self.Reposition()
        
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        
        self.g1.Hide()
        self.autohide = True
        
    def OnIdle(self, evt):
        if self.autohide:
            if self.g1.GetValue()==0:
                if self.g1.IsShown():
                    self.g1.Hide()           
            else:
                if not self.g1.IsShown():
                    self.g1.Show()
       
    def OnSize(self, evt):
        self.Reposition()  

    def Reposition(self):
        rect = self.GetFieldRect(1)
        
        self.g1.SetPosition((self.GetRect()[2]-125, 4))   

class FeedManagerOpmlFetcher(threading.Thread):
    def __init__(self,url,gui):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.url = url
        self.gui = gui

    def run(self):
        sio = StringIO.StringIO()
        grabber = grabbers.BasicGrabber(self.url, sio, politeness=0)
        try:
            grabber()
        except grabbers.GrabError, ex:
            log.error("Can't grab %s: %s", url, ex.message)
            return
        self.gui.ThreadSafeDispatch(self.gui.ReplaceFromManagerOpmlEnsuringPopulate, self.url, sio.getvalue())

class UpdateChecker(threading.Thread):
    def __init__(self, event, stringtable, currentlanguage, frame, gui):
        threading.Thread.__init__(self) 
        self.setDaemon(True)
        self.event = event
        self.m_stringtable = stringtable
        self.m_currentlanguage = currentlanguage
        self.frame = frame
        self.gui = gui

    def run(self):
        def getText(nodelist):
            rc = ""
            for node in nodelist:
                if node.nodeType == node.TEXT_NODE:
                    rc = rc + node.data
            return rc

        try:
            # We use the grabber to get our version check now.
            #
            import StringIO
            sio = StringIO.StringIO()
            bg = grabbers.BasicGrabber(CURRENT_VERSION_URL, sio)
            bg()
            updates = parseString(sio.getvalue())
            current_version_linux = getText(updates.getElementsByTagName("current_version_linux")[0].childNodes)
            current_version_other = getText(updates.getElementsByTagName("current_version_other")[0].childNodes)

            link = getText(updates.getElementsByTagName("link")[0].childNodes)
            description= getText(updates.getElementsByTagName("description")[0].childNodes)
        
            new_version = False
            if "Linux" in platform.system():
		# CHECK_VERSION
                if (CHECK_VERSION < float(current_version_linux)):
                    new_version = True
            else:
                if (CHECK_VERSION < float(current_version_other)):
                    new_version = True

        except:
            log.info("Exception checking for update at url %s" % CURRENT_VERSION_URL)
            if self.event:
                self.gui.ThreadSafeDispatch(self.notify_gui_error)
            return

        if self.event or new_version:
            self.gui.ThreadSafeDispatch(self.notify_gui, new_version, link, description)

    def notify_gui(self, new_version, link, description):

        if new_version:
            user_message = self.m_stringtable.GetText(self.m_currentlanguage, "str_new_version_ipodder")
            user_message += "\n\n" + str(description)
        else:
            user_message = self.m_stringtable.GetText(self.m_currentlanguage, "str_no_new_version_ipodder")
            
        if new_version:
            alert = wx.MessageDialog(self.frame, user_message, style=wx.OK|wx.CANCEL)
        else:
            alert = wx.MessageDialog(self.frame, user_message, style=wx.OK)
        
        response = alert.ShowModal()
        alert.Destroy()
        if response == wx.ID_OK:
            if new_version:
                webbrowser.open_new(str(link))                    

    def notify_gui_error(self):
        errmsg = self.m_stringtable.GetText(self.m_currentlanguage, "str_error_checking_new_version")
        alert = wx.MessageDialog(self.frame, errmsg, style=wx.OK)
        response = alert.ShowModal()
        alert.Destroy()

class KeyWatchingCaller(threading.Thread):
    def __init__(self, themethod, param, currenttable, duration):
        threading.Thread.__init__(self) 
        self.m_method = themethod
        self.m_param = param
        self.m_table = currenttable
        self.m_duration = duration
    def run(self):
        import time
        time.sleep(self.m_duration)
        if len(self.m_table)==1:
            self.m_method(self.m_param)
        self.m_table.remove(self)
        
def timed_search_subs(self):
    query = self.searchboxfeeds.GetValue()
    
    self.feedslist.DeleteAllItems()
    self.episodes.DeleteAllItems() 
 
    if len(query)==0:
        self.PopulateFeedsList()
        return 
 
    fds = self.ipodder.feeds

    count = 0
    self.feedsdict = {}

    for feedinfo in fds:
        if feedinfo.title:
            search_title = feedinfo.title
        else:
            search_title = feedinfo.url
        #print dir(feedinfo)
        if (query.lower() in search_title.lower())|(query.lower() in feedinfo.url.lower())|(query.lower() in feedinfo.sub_state.lower()):            
            if feedinfo.sub_state in ['unsubscribed', 'disabled'] \
                and not self.ipodder.config.debug:
                continue
            #if sub_state == 'preview':
            #    continue
            id = wx.NewId()
            self.feedsdict[id] = feedinfo

            if feedinfo.title:
                index = self.feedslist.InsertImageStringItem(0,feedinfo.title,self.lemon_idle_idx)
            else:
                index = self.feedslist.InsertImageStringItem(0,feedinfo.url,self.lemon_idle_idx)
            for i in range(0,2):
                self.feedslist.SetStringItem(0,1,self._("str_" + feedinfo.sub_state))
                self.feedslist.SetStringItem(0,2,'%4.1f' % feedinfo.mb_on_disk())
                self.feedslist.SetStringItem(0,3,trimurl(feedinfo.url))
                self.feedslist.SetItemData(0,id)
    self.mainpanel.ResetSortMixin()        

def search_subs(self):
    kwc = KeyWatchingCaller(timed_search_subs, self, self.m_sptl_subs_threads, 0.75)
    self.m_sptl_subs_threads.append(kwc)
    kwc.start()
    return

def timed_search_downloads(self):
    query = self.searchboxdownloads.GetValue()
    self.downloads.DeleteAllItems()
    for encinfo in self.m_encinfolist:
        if (query.lower() in str(encinfo.item_title).lower())|(query.lower() in str(encinfo.feed).lower())|(query.lower() in str(encinfo.url).lower())|(query.lower() in str(encinfo.status)):
            self.DownloadTabLog(encinfo,prune=False)
    self.DownloadTabPrune()
    
def search_downloads(self):
    kwc = KeyWatchingCaller(timed_search_downloads, self, self.m_sptl_dwnl_threads, 0.75)
    self.m_sptl_dwnl_threads.append(kwc)
    kwc.start()
    return

## BEGIN new class by motto
class SyncMediaPlayer(wx.App):
    def OnInit(self):
        #self.res = xrc.XmlResource(self.ipodder.config.mediasync_file)
        self.res = xrc.XmlResource("gui/sync-player.xrc")
        self.InitFrame()
        self.InitEverythingElse()
        self.DoTheInitJob()
        return True

    def InitFrame(self):
        self.frame2 = self.res.LoadFrame(None, "MainFrame")
        self.panel2 = xrc.XRCCTRL(self.frame2, "MainPanel")
        self.checklistbox2 = xrc.XRCCTRL(self.panel2, "MainCheckListBox")
        self.textctrl2 = xrc.XRCCTRL(self.panel2, "MainTextCtrl")
        self.browsebutton2 = xrc.XRCCTRL(self.panel2, "MainBrowseButton")
        self.checkbox2 = xrc.XRCCTRL(self.panel2, "MainCheckBox")
        self.syncbutton2 = xrc.XRCCTRL(self.panel2, "MainSyncButton")
        self.cancelbutton2 = xrc.XRCCTRL(self.panel2, "MainCancelButton")
        wx.EVT_BUTTON(self,xrc.XRCID("MainBrowseButton"), self.OnBrowseButton)
        wx.EVT_BUTTON(self,xrc.XRCID("MainSyncButton"), self.OnSyncButton)
        wx.EVT_BUTTON(self,xrc.XRCID("MainCancelButton"), self.OnCancelButton)

    def InitEverythingElse(self):
        sizer = self.panel2.GetSizer()
        sizer.Fit(self.frame2)
        sizer.SetSizeHints(self.frame2)
        self.frame2.Show()

    def DoTheInitJob(self):
        ## Populate CheckListBox Window including size of files
	os.system("find " + self.config.download_dir + " -type f >  /tmp/actual_files.txt")
        file = open("/tmp/actual_files.txt")
        while True:
            line = string.replace(file.readline(), "\n", "")
            if len(line) == 0:
                break
            array.append(line)
        file.close()
        for i in range(0, len(array)):
	     name = string.replace(array[i], DOWNLOADPATH, "")
	     bytes = os.path.getsize(array[i])
	     megabytes = bytes / (1024. * 1024)
	     megabytes = round(megabytes, 2)
	     name = name + "   (" + str(megabytes) + " MB)"
             self.checklistbox2.Append(name)
        ## Preset path for Mediaplayer
        self.textctrl2.SetValue(SYNCPATH)

    def OnBrowseButton(self, evt):
        dlg = wx.DirDialog(self.frame2,"Choose download directory",self.textctrl2.GetValue())
        if dlg.ShowModal() == wx.ID_OK:
            self.textctrl2.SetValue(dlg.GetPath())
        dlg.Destroy()

    def DisplayErrorMessage(self):
	dlg2 = wx.MessageDialog(self.frame2, "No Mediaplayer present...",
                              'Error Message', wx.OK | wx.ICON_ERROR)
	dlg2.ShowModal()
	dlg2.Destroy()

    def OnSyncButton(self, evt):
        dlg = wx.MessageDialog(self.frame2, "Sync all marked files to the Mediaplayer?",
                              'Syncing Mediaplayer', wx.OK | wx.CANCEL | wx.ICON_EXCLAMATION)
        if dlg.ShowModal() == wxID_OK:
            dst = self.textctrl2.GetValue()
	    if self.checkbox2.GetValue() == 1:
		if os.path.exists(SYNCPATH):
                    os.system("rm -f " + SYNCPATH + "/*")
		else:
		    self.DisplayErrorMessage()
		    return
            for i in range(0, len(array)):
                if self.checklistbox2.IsChecked(i):
                    fraction = os.path.split(array[i])
                    dst2 = dst + "/" + fraction[1]
		    src2 = re.escape(array[i])
		    dst2 = re.escape(dst2)
		    if os.system("cp " + src2 + " " + dst2) != 0:
		        self.DisplayErrorMessage()
        dlg.Destroy()

    def OnCancelButton(self, evt):
        self.frame2.Show(0)

##  END new class by motto

class IPG_Preferences:
    """Mixin class to provide preferences dialog."""

    def InitMixin(self, res, xrc): 
        """Initialise the mixin with res, xrc."""
        self.preferences = res.LoadDialog(None, "PREFERENCES")
        if hasattr(self.preferences, 'MacSetMetalAppearance'):
            self.preferences.MacSetMetalAppearance(True)
        self.preferences.Show(0)
        self.preferences.Init(self.ipodder, self)

class IPG_Menu: 
    """Mixin class to provide the menu."""

    def InitMixin(self, res, xrc): 
        """Initialise the mixin with res, xrc."""
        wx.EVT_MENU(self,xrc.XRCID("MANUEBARHIDE"), self.OnHide)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARQUIT"), self.OnExit)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCLOSE"), self.OnCloseWindow)
        wx.EVT_MENU(self,xrc.XRCID("MENUBAROPMLEXPORT"), self.OnMenuOpmlExport)
        wx.EVT_MENU(self,xrc.XRCID("MENUBAROPMLIMPORT"), self.OnMenuOpmlImport)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARPREFERENCES"), self.OnMenuPreferences)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCHECKALL"), self.OnCheckNow)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCATCHUP"), self.OnCatchup)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARADDFEED"), self.OnMenuAddFeed)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARDOWNLOADS"), self.OnMenuDownloads)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARSUBSCRIPTIONS"), self.OnMenuSubscriptions)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCLEANUP"), self.OnMenuCleanup)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARLICENSE"), self.OnMenuLicense)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARABOUT"), self.OnMenuAbout)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARDIRECTORY"), self.OnMenuDirectory)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARSCHEDULER"), self.OnMenuScheduler)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARHELP"), self.OnMenuHelp)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARFAQ"), self.OnMenuFaq)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARGOTOWEBSITE"), self.OnMenuGotoWebsite)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARDONATE"), self.OnMenuDonate)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARREPORTPROBLEM"), self.OnMenuReportProblem)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCHECKFORUPDATES"), self.OnMenuCheckForUpdates)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARFEEDPROPERTIES"), self.OnOpenFeedProperties)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARREMOVEFEED"), self.OnToggleChecked)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARSELECTALL"), self.OnMenuSelectAll)
        wx.EVT_MENU(self,xrc.XRCID("MENUBARCHECKSELECTED"), self.OnCheckSelected)
        ##  New Menu event by motto
        wx.EVT_MENU(self,xrc.XRCID("MENUBARDELETEDOWNLOADS"), self.OnDeleteAllDownloads)
	##needs to be worked on still -- sgrayban
	wx.EVT_MENU(self,xrc.XRCID("MENUBARSYNCMEDIAPLAYER"), self.OnSyncMediaPlayer)
	##  END new Menu events by motto

        #Edit menu
        wx.EVT_NOTEBOOK_PAGE_CHANGED(self,xrc.XRCID("NOTEBOOK"), self.OnNotebookPageChanged)
        self.FrobMenus()

       ##  New function by motto
    def OnDeleteAllDownloads(self,event):
       delmsg = self.m_stringtable.GetText(self.m_currentlanguage, "str_del_ask")
       delmsg2 = self.m_stringtable.GetText(self.m_currentlanguage, "str_del_ask1")
       delmsg3 = self.m_stringtable.GetText(self.m_currentlanguage, "str_del_ask2")
       delwintitle = self.m_stringtable.GetText(self.m_currentlanguage, "str_del_wintitle")
       array = []
       os.system("find " + self.ipodder.config.download_dir + " -type f > /tmp/actual_files.txt")
       file = open("/tmp/actual_files.txt")
       while True:
           line = string.replace(file.readline(), "\n", "")
           if len(line) == 0:
               break
           array.append(line)
       file.close()
       anzahl = len(array)
       countbytes = 0
       for i in range(0, len(array)):
           bytes = os.path.getsize(array[i])
	   countbytes = countbytes + bytes
       megabytes = countbytes / (1024 * 1024)
       megabytes = str(megabytes)
       anzahl = str(anzahl)
       dlg = wx.MessageDialog(self.frame, delmsg + anzahl + delmsg2 + megabytes + delmsg3, delwintitle, wx.OK | wx.CANCEL | wx.ICON_EXCLAMATION)
       if dlg.ShowModal() == wxID_OK:
           os.system("cd " + self.ipodder.config.download_dir + "; find -type f -exec /bin/rm {} \;")
       dlg.Destroy()

    def OnSyncMediaPlayer(self, event):
	#pass
	SyncMediaPlayer()
    ##  END new functions by motto

    def OnMenuPreferences(self,event):
        """Show the Preferences dialog."""
        self.preferences.ShowModal()
        self.frame.SetFocus()
        
    def OnMenuOpmlExport(self,event):
        dlg = wx.FileDialog(self.frame,self.m_stringtable.GetText(self.m_currentlanguage, "str_choose_name_export_file"),self.ipodder.config.download_dir,"castpodder-subscriptions.opml","*.opml",style=wx.SAVE)
        if dlg.ShowModal() == wx.ID_OK:
          self.ipodder.feeds.write_to_opml_file(dlg.GetPath())
          alert = wx.MessageDialog(self.frame, self.m_stringtable.GetText(self.m_currentlanguage, "str_subs_exported"), style=wx.OK)
          alert.ShowModal()
          alert.Destroy()
          
        dlg.Destroy()

    def OnMenuOpmlImport(self,event):
        dlg = wx.FileDialog(self.frame,self.m_stringtable.GetText(self.m_currentlanguage, "str_select_import_file"),self.ipodder.config.download_dir,"subscriptions.opml","*.opml",style=wx.OPEN)
        if dlg.ShowModal() == wx.ID_OK:
          n = self.ipodder.feeds.absorb_from_opml_file(dlg.GetPath())
          if n == None:
              message = "There was an error importing the file.  Sorry it didn't work out."
          else:
              message = "%d feeds imported." % n
          alert = wx.MessageDialog(self.frame, message, style=wx.OK)
          alert.ShowModal()
          alert.Destroy()
          self.PopulateFeedsList()

        dlg.Destroy()

    def OnMenuAbout(self,event):
        self.about.ShowModal()
        self.frame.SetFocus()
        
    def OnMenuAddFeed(self,event):
        self.feedwindow.UpdateFeed(None,self.ipodder,newfeed="")
        self.frame.SetFocus()
        
    def OnMenuDownloads(self,event):
        self.notebook.SetSelection(DOWNLOADS_INDEX)

    def OnMenuSubscriptions(self,event):
        self.notebook.SetSelection(SUBSCRIPTIONS_INDEX)
        
    def OnMenuDirectory(self,event):
        self.notebook.SetSelection(DIRECTORY_INDEX)

    def OnMenuScheduler(self,event):
        self.scheddialog.ShowModal()
        self.frame.SetFocus()
        
    def OnMenuCleanup(self,event):
        self.notebook.SetSelection(CLEANUP_INDEX)

    def OnMenuSubmitLang(self,event):
        webbrowser.open("http://wiki.castpodder.net/doku.php/instructions_for_translators")

    def OnMenuHelp(self,event):
        webbrowser.open("http://forum.castpodder.net/phpBB2/index.php?c=2")

    def OnMenuFaq(self,event):
        webbrowser.open("http://www.castpodder.net/")

    def OnMenuGotoWebsite(self,event):
        webbrowser.open("http://www.castpodder.net/")

    def OnMenuDonate(self,event):
        webbrowser.open("http://forum.castpodder.net/index.php?pid=3")

    def OnMenuReportProblem(self,event):
        # lets get the linux users to post in the forum instead of the bug tracker to make life easier
        # for the linux coders -- mainly me :) (sgrayban)
        webbrowser.open("http://dev-1.borgforge.net/trac/castpodder/wiki/WikiStart#ReportingBugs")

    def OnMenuCheckForUpdates(self,event):
        upc = UpdateChecker(event, self.m_stringtable, self.m_currentlanguage, self.frame, self);
        upc.start()

        
class IPG_Language: 
    """Mixin class to provide language services."""
    
    # we have a better way to add new lanuages to iPodder
    # using a loop in the localization/catalog/ directory
    def InitMixin(self, res, xrc): 
        pass###

    def OnMenuLang(self, event):
        self.SetLanguages(self.menulangdict[event.GetId()])

class IPG_DownloadRate: 
    """Mixin class to provide download rate hooks, etc."""

    def InitMixin(self, res, xrc, pb): 
        """Initialise the mixin with res, xrc."""
        log.debug("IPG_DownloadRate initialised.")
        self.__live = xrc.XRCCTRL(self.frame, "DL_LIVE")
        self.__ulspeed = xrc.XRCCTRL(self.frame, "DL_ULSPEED")
        self.__dlspeed = xrc.XRCCTRL(self.frame, "DL_DLSPEED")
        self.__pb = pb

    def hook_download_content_rate(self, live, ulrate, dlrate, percent): 
        """This is hooked to iPodder's download-content-rate by InitHooks."""
        dispatch = self.ThreadSafeDispatch
        dispatch(self.__live.SetLabel, "%1d" % live)
        dispatch(self.__ulspeed.SetLabel, "%.1fkB/s" % (ulrate/1024.0))
        dispatch(self.__dlspeed.SetLabel, "%.1fkB/s" % (dlrate/1024.0))
        dispatch(self.__pb.SetValue, percent)

class IPG_Skin:
    """Mixin class to provide a linked banner logo"""
    def InitMixin(self,xrc):
        toolbarbanner = xrc.XRCCTRL(self.frame, "TOOLBARBANNER")
        if not hasattr(skin, "GetBannerImage"):
            sizer = toolbarbanner.GetContainingSizer()
            sizer.Clear(True)
            notebook = xrc.XRCCTRL(self.frame, "NOTEBOOK")
            notebook.GetContainingSizer().Remove(sizer)
        else:
            toolbarbanner.DeleteTool(xrc.XRCID("TOOLBANNER"))
            bmp = skin.GetBannerImage().ConvertToBitmap()
            toolbarbanner.SetToolBitmapSize(bmp.GetSize())
            toolid = wx.NewId()
            toolbarbanner.AddSimpleTool(toolid,bmp)
            toolbarbanner.Realize()
            if hasattr(skin, "BANNER_URL"):
                wx.EVT_TOOL(self, toolid, self.OnBannerClick)

class iPodderGui(wx.App, 
                 GenericDispatch.GenericDispatchMixin, 
                 wx.Frame,
                 IPG_Preferences,
                 IPG_Menu,
                 IPG_DownloadRate,
                 IPG_Language,
                 IPG_Skin
                 ):

    def __init__(self,ipodder):
        self.ipodder = ipodder
        
        # wxApp usually sends error messages to a wxWindow. This can be a problem if you are trying to debug 
        # a crash, the window disappears before you can see the traceback. The first argument to wxApp is 
        # redirect=True, the second is filename=None. You specify a filename to write to that file, or 
        # specify false to redirect to write to the console.
        wx.App.__init__(self, False, None)
        GenericDispatch.GenericDispatchMixin.__init__(self)
        
    def OnMenuLicense(self, event):
        alert = wx.MessageDialog(self.frame, self.m_stringtable.GetText(self.m_currentlanguage, "str_license"), style=wx.OK, caption=self._("str_license_caption"))
        response = alert.ShowModal()
        alert.Destroy()
        if response != wx.ID_OK:
            return

    def InitLanguageMenu(self):
        "Update language menu, it behaves as a radiomenu."

        langmenuitem = self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTLANGUAGE"))
        langmenu = langmenuitem.GetSubMenu()

        #Clear old items to handle Cancels.
        while langmenu.GetMenuItemCount():
            langmenu.DeleteItem(langmenu.FindItemByPosition(0))
        
        for lang in LanguageModule.supported_languages():
            id = wx.NewId()
            try: 
                langmenu.AppendRadioItem(id,catalog.get_language_name(lang))
                self.menulangdict[id] = lang
                wx.EVT_MENU(self, id, self.OnMenuLang)
                if self.m_currentlanguage == lang:
                    self.menubar.FindItemById(id).Check()
            except TypeError, ex: 
                log.exception("Can't append language menu item.")

        langmenu.AppendSeparator()
        id = wx.NewId()
        langmenu.Append(id, self._("str_submit_lang"))
        wx.EVT_MENU(self, id, self.OnMenuSubmitLang)

    def EnableLanguages(self, enable=True):
        langmenuitem = self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTLANGUAGE"))
        langmenu = langmenuitem.GetSubMenu()
        for i in range(langmenu.GetMenuItemCount()):
             langmenu.FindItemByPosition(i).Enable(enable)
             

    def SetLanguages(self, newlanguage=None):
        """Set the widget labels to the translations in self.m_currentlanguage.  Optionally
           prompt to change to newlanguage if it's not None."""

        if newlanguage:
            self.m_stringtable.LoadLanguage(newlanguage)
            alert = wx.MessageDialog(self.frame, self.m_stringtable.GetText(newlanguage, "str_localization_restart"), style=wx.OK|wx.CANCEL)
            response = alert.ShowModal()
            alert.Destroy()
            if response != wx.ID_OK:
                self.InitLanguageMenu()
                return
            else:
                self.ipodder.config.screen_language = self.m_currentlanguage = newlanguage
                self.ipodder.config.flush()
                self.OnExit(None)   

        # title
        self.frame.SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_ipodder_title"))
        
        # menus 
        self.menubar.SetLabelTop(0, self.m_stringtable.GetText(self.m_currentlanguage, "str_file"))                

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBAROPMLIMPORT")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBAROPMLIMPORT")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_import_opml"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBAROPMLIMPORT")).SetAccel(tmp_accell)   
        
        self.menubar.FindItemById(xrc.XRCID("MENUBAROPMLEXPORT")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_export_opml"))        

        # save the accelerator (bug in windows?)
        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARQUIT")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARQUIT")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_quit"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARQUIT")).SetAccel(tmp_accell)
                
        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARCLOSE")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARCLOSE")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_close_window"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARCLOSE")).SetAccel(tmp_accell)

        self.menubar.FindItemById(xrc.XRCID("MENUBARPREFERENCES")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_preferences_menubar")) 

        ##  New Handling of new functions by motto
        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARDELETEDOWNLOADS")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARDELETEDOWNLOADS")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_delete_downloads"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARDELETEDOWNLOADS")).SetAccel(tmp_accell)
	##needs to be worked on still -- sgrayban
        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARSYNCMEDIAPLAYER")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARSYNCMEDIAPLAYER")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_sync_mediaplayer"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARSYNCMEDIAPLAYER")).SetAccel(tmp_accell)

        self.menubar.SetLabelTop(1, self.m_stringtable.GetText(self.m_currentlanguage, "str_edit"))                

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTALL")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTALL")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_select_all"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTALL")).SetAccel(tmp_accell)   

        self.menubar.SetLabelTop(3, self.m_stringtable.GetText(self.m_currentlanguage, "str_tools"))

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARCHECKALL")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARCHECKALL")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_check_all"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARCHECKALL")).SetAccel(tmp_accell)   

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARCATCHUP")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARCATCHUP")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_catch_up"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARCATCHUP")).SetAccel(tmp_accell)   

        self.menubar.FindItemById(xrc.XRCID("MENUBARCHECKSELECTED")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_check_selected"))

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARREMOVEFEED")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARREMOVEFEED")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_remove_selected"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARREMOVEFEED")).SetAccel(tmp_accell)   

        self.menubar.FindItemById(xrc.XRCID("MENUBARFEEDPROPERTIES")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_feed_properties"))

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARADDFEED")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARADDFEED")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_add_feed"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARADDFEED")).SetAccel(tmp_accell)   

        self.menubar.FindItemById(xrc.XRCID("MENUBARSCHEDULER")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_scheduler_menubar"))

        self.menubar.FindItemById(xrc.XRCID("MENUBARSELECTLANGUAGE")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_select_language"))
        

        langdef = {
            'ENGLISH': 'english', 
            'DUTCH': 'nederlands', 
            'JAPANESE': 'japanese', 
            'FRENCH': 'francais', 
            'GERMAN': 'deutsch', 
            'ITALIAN': 'italiano', 
            'SPANISH': 'espanol', 
            'BRAZILIAN_PORTUGESE': 'portuges'
            }
            
        for langid, strid in langdef.items(): 
             xrcid = 'MENUBARLANG%s' % langid
             textid = 'str_%s' % strid
             try: 
                 menuitem = self.menubar.FindItemById(xrc.XRCID(xrcid))
                 if menuitem is None: 
                     log.debug("Couldn't find menu item %s", xrcid)
                     continue
                 xlated = self.m_stringtable.GetText(self.m_currentlanguage, textid)
                 if "unicode" not in wx.PlatformInfo:
                     xlated = xlated.encode('ascii', 'replace')

                 menuitem.SetText(xlated)
             except TypeError: 
                 log.debug("Language %s didn't work.", langid)
                 pass

        self.InitLanguageMenu()

        

        self.menubar.SetLabelTop(2, self.m_stringtable.GetText(self.m_currentlanguage, "str_view"))                
        self.menubar.FindItemById(xrc.XRCID("MENUBARDOWNLOADS")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_downloads"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARSUBSCRIPTIONS")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_subscriptions"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARDIRECTORY")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_podcast_directory"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARCLEANUP")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_cleanup"))

        if wx.Platform == '__WXMAC__':
            #Regardless of language we have to set the Help menu label
            #to "&Help" to avoid duplication.
            self.menubar.SetLabelTop(4,"&Help")
        else:
            self.menubar.SetLabelTop(4, self.m_stringtable.GetText(self.m_currentlanguage, "str_help"))                        

        tmp_accell = self.menubar.FindItemById(xrc.XRCID("MENUBARHELP")).GetAccel()
        self.menubar.FindItemById(xrc.XRCID("MENUBARHELP")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_online_help"))        
        self.menubar.FindItemById(xrc.XRCID("MENUBARHELP")).SetAccel(tmp_accell)   

        self.menubar.FindItemById(xrc.XRCID("MENUBARFAQ")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_faq"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARCHECKFORUPDATES")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_check_for_update"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARREPORTPROBLEM")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_report_a_problem"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARGOTOWEBSITE")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_goto_website"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARDONATE")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_make_donation"))
        
        self.menubar.FindItemById(xrc.XRCID("MENUBARLICENSE")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_menu_license"))
        self.menubar.FindItemById(xrc.XRCID("MENUBARABOUT")).SetText(self.m_stringtable.GetText(self.m_currentlanguage, "str_about"))
        
        # set the tabs
        tabslist = [
            (self.notebook, DOWNLOADS_INDEX, "str_downloads"),
            (self.notebook, SUBSCRIPTIONS_INDEX, "str_subscriptions"),
            (self.notebook, DIRECTORY_INDEX, "str_podcast_directory"),
            (self.notebook, CLEANUP_INDEX, "str_cleanup"),
            (self.schednotebook, 0, "str_scheduler_tab")]
        en_loaded = False
        for (nb, idx, key) in tabslist:
            try:
                nb.SetPageText(idx, self._(key))
            except AssertionError:
                """Unfortunately wide characters and Notebooks don't mix well
                on Mac, so we fall back to English."""
                if not en_loaded:
                    self.m_stringtable.LoadLanguage(LanguageModule.ENGLISH)
                    en_loaded = True
                try:
                    nb.SetPageText(idx,self.m_stringtable.GetText(LanguageModule.ENGLISH,key))
                except AssertionError:
                    #This shouldn't happen but somehow does when shutting down
                    #after switching to German.  Go figure.
                    pass

        try: 
          self.notebook.SetPageText(LOGPAGE_INDEX, self.m_stringtable.GetText(self.m_currentlanguage, "str_log"))
        except:
            pass

        self.toolbarDownloads.SetToolShortHelp(xrc.XRCID("TOOLHISTPAUSESELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_pause_selected"))
        self.toolbarDownloads.SetToolShortHelp(xrc.XRCID("TOOLHISTCANCELSELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_cancel_selected_download"))
        self.toolbarDownloads.SetToolShortHelp(xrc.XRCID("TOOLHISTCLEARSELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_remove_selected_items"))

        xrc.XRCCTRL(self.frame, "DL_LIVE_LABEL").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_dltab_live"))
        xrc.XRCCTRL(self.frame, "DL_ULSPEED_LABEL").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_dltab_ul_speed"))
        xrc.XRCCTRL(self.frame, "DL_DLSPEED_LABEL").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_dltab_dl_speed"))

        self.frame.SetStatusText(self.m_stringtable.GetText(self.m_currentlanguage, "str_check_for_new_podcast_button"))
        self.toolbarSubscr.SetToolShortHelp(self.toolCheckAllId,self.m_stringtable.GetText(self.m_currentlanguage, "str_check_for_new_podcasts"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLADDFEED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_add_new_feed"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLTOGGLECHECKED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_remove_selected_feed"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLFEEDPROPERTIES"),self.m_stringtable.GetText(self.m_currentlanguage, "str_properties"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLCHECKSELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_check_selected_feed"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLCATCHUP"),self.m_stringtable.GetText(self.m_currentlanguage, "str_catch_up_mode"))

        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLHISTPAUSESELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_pause_selected"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLHISTCANCELSELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_cancel_selected_download"))
        self.toolbarSubscr.SetToolShortHelp(xrc.XRCID("TOOLHISTCLEARSELECTED"),self.m_stringtable.GetText(self.m_currentlanguage, "str_remove_selected_items"))
        
        self.toolbarDirectory.SetToolShortHelp(xrc.XRCID("TOOLREFRESHDIR"), self._("str_refresh"))
        self.toolbarDirectory.SetToolShortHelp(xrc.XRCID("TOOLOPENDIRALL"), self._("str_open_all_folders"))
        self.toolbarDirectory.SetToolShortHelp(xrc.XRCID("TOOLCLOSEDIR"), self._("str_close_all_folders"))

        xrc.XRCCTRL(self.frame, "DIRECTORY_DESCRIPTION").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_directory_description"))
        xrc.XRCCTRL(self.frame, "ID_ADDFEED").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_add"))

        xrc.XRCCTRL(self.frame, "SELECTAFEED").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_select_a_feed"))
        xrc.XRCCTRL(self.frame, "CLEANUPREFRESH").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_refresh_cleanup"))
        xrc.XRCCTRL(self.frame, "LOOKFOREPISODES").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_look_in"))
        xrc.XRCCTRL(self.frame, "CLEANUPSRCPLAYER").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_player_library"))
        xrc.XRCCTRL(self.frame, "CLEANUPSRCFOLDER").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_downloads_folder"))
        xrc.XRCCTRL(self.frame, "CLEANUPDELLIBRARY").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_delete_library_entries"))
        xrc.XRCCTRL(self.frame, "CLEANUPDELFILES").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_delete_files"))
        xrc.XRCCTRL(self.frame, "CLEANUPCHECKALL").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_select_all_cleanup"))
        xrc.XRCCTRL(self.frame, "CLEANUPCHECKNONE").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_select_none_cleanup"))
        xrc.XRCCTRL(self.frame, "CLEANUPDELETE").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_delete"))

        xrc.XRCCTRL(self.frame, "ID_CLEARLOG").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_clear"))
        xrc.XRCCTRL(self.frame, "NEXTRUNLABEL").SetLabel(self.m_stringtable.GetText(self.m_currentlanguage, "str_next_run"))

	for (id,key) in [(self.feedmenu_checknow_id,"str_check_now"),\
                         (self.feedmenu_remove_id,"str_remove"),\
                         (self.feedmenu_openinbrowser_id,"str_open_in_browser"),\
                         (self.feedmenu_openfolder_id,"str_open_downloads_folder"),\
                         (self.feedmenu_properties_id,"str_properties")]:
            self.feedmenu.FindItemById(id).SetText(self._(key))

        for (id,key) in [(self.directory_refresh_id,"str_refresh")]:
            self.directory_root_menu.FindItemById(id).SetText(self._(key))

        # Feed properties
        xrc.XRCCTRL(self.feedwindow, "LBL_FEEDWINTITLE").SetLabel(self._("str_title"))
        xrc.XRCCTRL(self.feedwindow, "LBL_FEEDWINURL").SetLabel(self._("str_url"))
        xrc.XRCCTRL(self.feedwindow, "FEEDWINGOTOSUBS").SetLabel(self._("str_goto_subs"))
        xrc.XRCCTRL(self.feedwindow, "FEEDWINCANCEL").SetLabel(self._("str_cancel"))
        xrc.XRCCTRL(self.feedwindow, "FEEDWINOK").SetLabel(self._("str_save"))
        self.feedwindow.SetAcceleratorTable(
            wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, xrc.XRCID("FEEDWINCANCEL"))
            ]))

        # Scheduler dialog
        
        xrc.XRCCTRL(self.scheddialog, "SCHEDDIALOG").SetLabel(self._("str_scheduler_dialog"))
        xrc.XRCCTRL(self.scheddialog, "SCHEDSELECTTYPE").SetLabel(self._("str_sched_select_type"))
        xrc.XRCCTRL(self.scheddialog, "LBL_LASTRUN").SetLabel(self._("str_latest_run"))
        xrc.XRCCTRL(self.scheddialog, "LBL_NEXTRUN").SetLabel(self._("str_next_run"))
        xrc.XRCCTRL(self.scheddialog, "SAVESCHED").SetLabel(self._("str_save"))
        xrc.XRCCTRL(self.scheddialog, "CANCELSCHED").SetLabel(self._("str_cancel"))
        xrc.XRCCTRL(self.scheddialog, "ENABLEAUTO").SetLabel(self._("str_enable_scheduler"))
For faster browsing, not all history is shown. View entire blame