@@ -55,7 +55,7 @@ def __init__(self, parent, frame_id, title, mplayerPath):
55
55
wx .Frame .__init__ (self , parent = parent , id = frame_id , title = title , size = frameSize )
56
56
self .panel = wx .Panel (self )
57
57
58
- self .SetIcon (wx .Icon ("favicon.ico" , wx .BITMAP_TYPE_ICO ))
58
+ self .SetIcon (wx .Icon (os . path . join ( linguaBaseDir , "favicon.ico" ) , wx .BITMAP_TYPE_ICO ))
59
59
60
60
self .currentFolder = self .get_current_folder (linguaBaseDir )
61
61
@@ -80,10 +80,15 @@ def __init__(self, parent, frame_id, title, mplayerPath):
80
80
81
81
self .mplayerPath = mplayerPath
82
82
83
- if not 'mplayer2' in self .mplayerPath and sys . platform != 'darwin' :
83
+ if not 'mplayer2' in self .mplayerPath :
84
84
mplayer_args = [
85
85
u'-noautosub' , u'-identify' , u'-slave' , u'-idle'
86
86
]
87
+ if sys .platform == 'darwin' :
88
+ mplayer_args .extend ([
89
+ u'-ao' , u'coreaudio' ,
90
+ u'-vo' , u'corevideo'
91
+ ])
87
92
else :
88
93
mplayer_args = [
89
94
u'--no-autosub' , u'--nosub' , u'--identify' , u'--slave' , u'--idle'
@@ -120,8 +125,8 @@ def __init__(self, parent, frame_id, title, mplayerPath):
120
125
#create subtitle control
121
126
self .subtitle = wx .html .HtmlWindow (self .panel , - 1 , name = _ ('subtitles' ),
122
127
style = wx .TE_READONLY | wx .TE_CENTER | wx .TE_WORDWRAP | wx .TE_MULTILINE )
123
- self .subtitle .SetBackgroundColour (wx .Color (0 , 0 , 0 ))
124
- self .subtitle .SetForegroundColour (wx .Color (255 , 255 , 255 ))
128
+ self .subtitle .SetBackgroundColour (wx .Colour (0 , 0 , 0 ))
129
+ self .subtitle .SetForegroundColour (wx .Colour (255 , 255 , 255 ))
125
130
self .subtitle .SetPage ('<body bgcolor="#000000"></body>' )
126
131
self .subtitle .SetFonts ('Consolas' ,'Consolas' )
127
132
self .subtitle .SetMinSize (wx .Size (- 1 , 100 ))
@@ -304,7 +309,7 @@ def build_menu(self):
304
309
305
310
#----------------------------------------------------------------------
306
311
def subtitle_setpage (self ,text ):
307
- html = '<body bgcolor="#000000"><center><font face="consolas " color="#ffffff" size="+2">' + text + '</font></center></body>'
312
+ html = '<body bgcolor="#000000"><center><font face="Consolas " color="#ffffff" size="+2">' + text + '</font></center></body>'
308
313
self .subtitle .SetPage (html )
309
314
310
315
#----------------------------------------------------------------------
@@ -668,7 +673,14 @@ def __init__( self, parent, selectedText ):
668
673
self .sourceText = wx .StaticText (self ,
669
674
wx .ID_ANY , wx .EmptyString , wx .DefaultPosition , wx .Size (- 1 , 40 ), wx .ALIGN_CENTRE )
670
675
self .sourceText .Wrap (- 1 )
671
- self .sourceText .SetFont (wx .Font (14 , 74 , 90 , 90 , False , "Consolas" ))
676
+
677
+ if sys .platform == 'win32' :
678
+ textFont = wx .Font (14 , 74 , 90 , 90 , False , "Consolas" )
679
+ else :
680
+ textFont = wx .Font (14 , 74 , 90 , 90 , False , "fixedsys" )
681
+
682
+ self .sourceText .SetFont (textFont )
683
+
672
684
self .sourceText .SetForegroundColour (wx .Colour (255 , 255 , 255 ))
673
685
self .sourceText .SetBackgroundColour (wx .Colour (0 , 0 , 0 ))
674
686
self .sourceText .SetMinSize (wx .Size (- 1 , 40 ))
@@ -680,7 +692,7 @@ def __init__( self, parent, selectedText ):
680
692
wx .ID_ANY , wx .EmptyString , wx .DefaultPosition , wx .Size (- 1 , 200 ),
681
693
wx .ALIGN_LEFT )
682
694
self .translateText .Wrap (- 1 )
683
- self .translateText .SetFont (wx . Font ( 14 , 74 , 90 , 90 , False , "Consolas" ) )
695
+ self .translateText .SetFont (textFont )
684
696
self .translateText .SetMinSize (wx .Size (- 1 , 200 ))
685
697
686
698
translateSizer .Add (self .translateText , 0 , wx .ALL | wx .EXPAND , 5 )
@@ -708,14 +720,11 @@ def __init__( self, parent, selectedText ):
708
720
709
721
self .loginLabel = wx .StaticText (self , wx .ID_ANY , _ (u"LinguaLeo login" ), wx .DefaultPosition ,
710
722
wx .Size (80 , 20 ), 0 )
711
- self .loginLabel .Wrap (- 1 )
723
+ self .passwordLabel = wx .StaticText (self , wx .ID_ANY , _ (u"Password" ), wx .DefaultPosition ,
724
+ wx .Size (80 , 20 ), 0 )
712
725
713
-
714
- self .passwordLabel = wx .StaticText (self , wx .ID_ANY , _ (u"Password" ), wx .DefaultPosition , wx .Size (80 , 20 ), 0 )
715
- self .passwordLabel .Wrap (- 1 )
716
-
717
- self .login = wx .TextCtrl (self , wx .ID_ANY , wx .EmptyString , wx .DefaultPosition , wx .Size (100 , 20 ), 0 )
718
- self .password = wx .TextCtrl (self , wx .ID_ANY , wx .EmptyString , wx .DefaultPosition , wx .Size (100 , 20 ), 0 )
726
+ self .login = wx .TextCtrl (self , - 1 , wx .EmptyString , wx .DefaultPosition , wx .Size (100 , 20 ), 0 )
727
+ self .password = wx .TextCtrl (self , - 1 , wx .EmptyString , wx .DefaultPosition , wx .Size (100 , 20 ), 0 )
719
728
720
729
leoSizer .Add (self .loginLabel , 1 , wx .ALL , 5 )
721
730
leoSizer .Add (self .login , 2 , wx .ALL , 5 )
@@ -742,15 +751,15 @@ def __init__( self, parent, selectedText ):
742
751
self .Bind (wx .EVT_CLOSE , self .on_close_dialog )
743
752
744
753
self .SetSizer (mainSizer )
745
- self .Centre (wx .BOTH )
746
754
self .Layout ()
755
+ self .CentreOnScreen ()
747
756
748
757
#----------------------------------------------------------------------
749
758
def build_lang_selector (self , labelTitle = '' , labelSize = wx .DefaultSize , comboSize = wx .DefaultSize , comboSelected = None ):
750
759
label = wx .StaticText (self , wx .ID_ANY , labelTitle , wx .DefaultPosition , labelSize , 0 )
751
760
label .Wrap (- 1 )
752
761
753
- combobox = combo .BitmapComboBox (self , wx . ID_ANY , wx .EmptyString , wx .DefaultPosition , comboSize , "" , wx .CB_READONLY )
762
+ combobox = combo .BitmapComboBox (self , - 1 , wx .EmptyString , wx .DefaultPosition , comboSize , "" , wx .CB_READONLY )
754
763
755
764
if not isinstance (combobox , combo .BitmapComboBox ):
756
765
return
@@ -865,6 +874,7 @@ def on_close_dialog(self, event):
865
874
866
875
LinguaCinema .cfg .set ('translate' ,'sourceLang' ,LinguaLeoDialog .langISO [self .sourceLang .GetSelection ()])
867
876
LinguaCinema .cfg .set ('translate' ,'targetLang' ,LinguaLeoDialog .langISO [self .targetLang .GetSelection ()])
877
+ event .Skip ()
868
878
869
879
#----------------------------------------------------------------------
870
880
def on_change_lang (self , event ):
@@ -919,9 +929,11 @@ def on_add_context(self, event):
919
929
if __name__ == "__main__" :
920
930
import os , sys
921
931
922
- paths = [
932
+ paths = []
933
+
934
+ paths .extend ([
923
935
r'bin\win32\mplayer2.exe' ,
924
- r'bin\ osx\ mplayer' ,
936
+ r'bin/ osx/ mplayer' ,
925
937
r'/usr/bin/mplayer' ,
926
938
r'/usr/bin/mplayer2' ,
927
939
r'/usr/bin/mplayer' ,
@@ -932,12 +944,12 @@ def on_add_context(self, event):
932
944
r'C:\Program Files\Mplayer2\mplayer2.exe' ,
933
945
r'C:\Program Files (x86)\Mplayer\mplayer.exe' ,
934
946
r'C:\Program Files\Mplayer\mplayer.exe' ,
935
- ]
947
+ ])
936
948
937
949
if getattr (sys , 'frozen' , None ):
938
950
paths .extend ([
939
951
os .path .join (sys ._MEIPASS , 'bin\win32\mplayer2.exe' ),
940
- os .path .join (sys ._MEIPASS , 'bin/osx/mplayer2 ' )
952
+ os .path .join (sys ._MEIPASS , 'bin/osx/mplayer ' )
941
953
])
942
954
943
955
mplayerPath = None
0 commit comments