Skip to content

Commit 151cd8e

Browse files
author
Slach
committed
first worked .dmg builder for Mac OSX 10.7 and wxPython 2.8, download binaries from http://code.google.com/p/linguacinema/downloads/list
1 parent 519708a commit 151cd8e

12 files changed

+56
-25
lines changed

LinguaCinema.py

+32-20
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, parent, frame_id, title, mplayerPath):
5555
wx.Frame.__init__(self, parent=parent, id=frame_id, title=title, size=frameSize)
5656
self.panel = wx.Panel(self)
5757

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))
5959

6060
self.currentFolder = self.get_current_folder(linguaBaseDir)
6161

@@ -80,10 +80,15 @@ def __init__(self, parent, frame_id, title, mplayerPath):
8080

8181
self.mplayerPath = mplayerPath
8282

83-
if not 'mplayer2' in self.mplayerPath and sys.platform != 'darwin':
83+
if not 'mplayer2' in self.mplayerPath:
8484
mplayer_args=[
8585
u'-noautosub', u'-identify', u'-slave', u'-idle'
8686
]
87+
if sys.platform == 'darwin':
88+
mplayer_args.extend([
89+
u'-ao', u'coreaudio',
90+
u'-vo', u'corevideo'
91+
])
8792
else:
8893
mplayer_args=[
8994
u'--no-autosub', u'--nosub', u'--identify', u'--slave', u'--idle'
@@ -120,8 +125,8 @@ def __init__(self, parent, frame_id, title, mplayerPath):
120125
#create subtitle control
121126
self.subtitle = wx.html.HtmlWindow(self.panel, -1, name=_('subtitles'),
122127
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))
125130
self.subtitle.SetPage('<body bgcolor="#000000"></body>')
126131
self.subtitle.SetFonts('Consolas','Consolas')
127132
self.subtitle.SetMinSize(wx.Size(-1, 100))
@@ -304,7 +309,7 @@ def build_menu(self):
304309

305310
#----------------------------------------------------------------------
306311
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>'
308313
self.subtitle.SetPage(html)
309314

310315
#----------------------------------------------------------------------
@@ -668,7 +673,14 @@ def __init__( self, parent, selectedText ):
668673
self.sourceText = wx.StaticText(self,
669674
wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, 40), wx.ALIGN_CENTRE)
670675
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+
672684
self.sourceText.SetForegroundColour(wx.Colour(255, 255, 255))
673685
self.sourceText.SetBackgroundColour(wx.Colour(0, 0, 0))
674686
self.sourceText.SetMinSize(wx.Size(-1, 40))
@@ -680,7 +692,7 @@ def __init__( self, parent, selectedText ):
680692
wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, 200),
681693
wx.ALIGN_LEFT)
682694
self.translateText.Wrap(-1)
683-
self.translateText.SetFont(wx.Font(14, 74, 90, 90, False, "Consolas"))
695+
self.translateText.SetFont(textFont)
684696
self.translateText.SetMinSize(wx.Size(-1, 200))
685697

686698
translateSizer.Add(self.translateText, 0, wx.ALL | wx.EXPAND, 5)
@@ -708,14 +720,11 @@ def __init__( self, parent, selectedText ):
708720

709721
self.loginLabel = wx.StaticText(self, wx.ID_ANY, _(u"LinguaLeo login"), wx.DefaultPosition,
710722
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)
712725

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)
719728

720729
leoSizer.Add(self.loginLabel, 1, wx.ALL, 5)
721730
leoSizer.Add(self.login, 2, wx.ALL, 5)
@@ -742,15 +751,15 @@ def __init__( self, parent, selectedText ):
742751
self.Bind(wx.EVT_CLOSE, self.on_close_dialog)
743752

744753
self.SetSizer(mainSizer)
745-
self.Centre(wx.BOTH)
746754
self.Layout()
755+
self.CentreOnScreen()
747756

748757
#----------------------------------------------------------------------
749758
def build_lang_selector(self, labelTitle='', labelSize=wx.DefaultSize, comboSize=wx.DefaultSize, comboSelected=None):
750759
label = wx.StaticText(self, wx.ID_ANY, labelTitle, wx.DefaultPosition, labelSize, 0)
751760
label.Wrap(-1)
752761

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)
754763

755764
if not isinstance(combobox, combo.BitmapComboBox):
756765
return
@@ -865,6 +874,7 @@ def on_close_dialog(self, event):
865874

866875
LinguaCinema.cfg.set('translate','sourceLang',LinguaLeoDialog.langISO[self.sourceLang.GetSelection()])
867876
LinguaCinema.cfg.set('translate','targetLang',LinguaLeoDialog.langISO[self.targetLang.GetSelection()])
877+
event.Skip()
868878

869879
#----------------------------------------------------------------------
870880
def on_change_lang(self, event):
@@ -919,9 +929,11 @@ def on_add_context(self, event):
919929
if __name__ == "__main__":
920930
import os, sys
921931

922-
paths = [
932+
paths = []
933+
934+
paths.extend([
923935
r'bin\win32\mplayer2.exe',
924-
r'bin\osx\mplayer',
936+
r'bin/osx/mplayer',
925937
r'/usr/bin/mplayer',
926938
r'/usr/bin/mplayer2',
927939
r'/usr/bin/mplayer',
@@ -932,12 +944,12 @@ def on_add_context(self, event):
932944
r'C:\Program Files\Mplayer2\mplayer2.exe',
933945
r'C:\Program Files (x86)\Mplayer\mplayer.exe',
934946
r'C:\Program Files\Mplayer\mplayer.exe',
935-
]
947+
])
936948

937949
if getattr(sys, 'frozen', None):
938950
paths.extend([
939951
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')
941953
])
942954

943955
mplayerPath = None

bin/osx/lib/libSDL-1.2.0.dylib

772 KB
Binary file not shown.

bin/osx/lib/libass.4.dylib

220 KB
Binary file not shown.

bin/osx/lib/libfaad.2.dylib

565 KB
Binary file not shown.

bin/osx/lib/libfribidi.0.dylib

197 KB
Binary file not shown.

bin/osx/lib/libmp3lame.0.dylib

560 KB
Binary file not shown.

bin/osx/lib/libogg.0.dylib

51.7 KB
Binary file not shown.

bin/osx/lib/libtheora.0.dylib

412 KB
Binary file not shown.

bin/osx/mplayer

1.8 MB
Binary file not shown.

build.osx.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
#sudo port install mplayer
3+
lipo -thin i386 -output ~/python-i386 /usr/bin/python2.7
4+
~/python-i386 ~/pyinstaller-2.0/pyinstaller.py --windowed --onefile pyinstaller.osx.spec
5+
hdiutil create ./install/LinguaCinema.dmg -srcfolder ./dist/LinguaCinema.app -ov

favicon.icns

753 Bytes
Binary file not shown.

pyinstaller.osx.spec

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- mode: python -*-
22
a = Analysis(['LinguaCinema.py'],
33
pathex=['../Lingualeo_player'],
4-
hiddenimports=['encodings','pysrt'],
4+
hiddenimports=[],
55
hookspath=None)
66
a.datas += [
77
('bitmaps/player_next.png', '../Lingualeo_player/bitmaps/player_next.png', 'DATA'),
@@ -10,9 +10,17 @@ a.datas += [
1010
('bitmaps/player_stop.png', '../Lingualeo_player/bitmaps/player_stop.png', 'DATA'),
1111
('bitmaps/player_pause.png', '../Lingualeo_player/bitmaps/player_pause.png', 'DATA'),
1212
('bitmaps/player_replay.png', '../Lingualeo_player/bitmaps/player_replay.png', 'DATA'),
13-
# ('bin/osx/mplayer', '../Lingualeo_player/bin/osx/mplayer', 'DATA'),
13+
('bin/osx/mplayer', '../Lingualeo_player/bin/osx/mplayer', 'DATA'),
14+
('bin/osx/lib/libSDL-1.2.0.dylib', '../Lingualeo_player/bin/osx/lib/libSDL-1.2.0.dylib', 'DATA'),
15+
('bin/osx/lib/libass.4.dylib', '../Lingualeo_player/bin/osx/lib/libass.4.dylib', 'DATA'),
16+
('bin/osx/lib/libfaad.2.dylib', '../Lingualeo_player/bin/osx/lib/libfaad.2.dylib', 'DATA'),
17+
('bin/osx/lib/libfribidi.0.dylib', '../Lingualeo_player/bin/osx/lib/libfribidi.0.dylib', 'DATA'),
18+
('bin/osx/lib/libmp3lame.0.dylib', '../Lingualeo_player/bin/osx/lib/libmp3lame.0.dylib', 'DATA'),
19+
('bin/osx/lib/libogg.0.dylib', '../Lingualeo_player/bin/osx/lib/libogg.0.dylib', 'DATA'),
20+
('bin/osx/lib/libtheora.0.dylib', '../Lingualeo_player/bin/osx/lib/libtheora.0.dylib', 'DATA'),
1421
('favicon.ico', '../Lingualeo_player/favicon.ico', 'DATA'),
15-
# ('mplayer/subfont.ttf', '../Lingualeo_player/mplayer/subfont.ttf', 'DATA'),
22+
('favicon.icns', '../Lingualeo_player/favicon.icns', 'DATA'),
23+
# ('bin/osx/mplayer/subfont.ttf', '../Lingualeo_player/bin/osx/mplayer/subfont.ttf', 'DATA'),
1624
('bitmaps/flags/en.png', '../Lingualeo_player/bitmaps/flags/en.png', 'DATA'),
1725
('bitmaps/flags/ru.png', '../Lingualeo_player/bitmaps/flags/ru.png', 'DATA'),
1826
('bitmaps/flags/es.png', '../Lingualeo_player/bitmaps/flags/es.png', 'DATA'),
@@ -32,10 +40,10 @@ exe = EXE(pyz,
3240
a.scripts,
3341
exclude_binaries=1,
3442
name=os.path.join('build/pyi.osx/LinguaCinema', 'LinguaCinema'),
35-
debug=True,
43+
debug=False,
3644
strip=None,
3745
upx=True,
38-
icon="favicon.ico",
46+
icon="favicon.icns",
3947
console=False )
4048

4149
coll = COLLECT(exe,
@@ -45,3 +53,9 @@ coll = COLLECT(exe,
4553
strip=None,
4654
upx=True,
4755
name=os.path.join('dist', 'LinguaCinema.osx'))
56+
57+
app = BUNDLE(coll,
58+
appname='LinguaCinema',
59+
name=os.path.join('dist', 'LinguaCinema.app'),
60+
icon="favicon.icns",
61+
version=1)

0 commit comments

Comments
 (0)