Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
moved gui layout to separate directory,
Browse files Browse the repository at this point in the history
added generated gui files since it is pain to generate it on some platforms
  • Loading branch information
Michał Szymaniak committed Jan 5, 2019
1 parent 108a753 commit 81704b8
Show file tree
Hide file tree
Showing 33 changed files with 1,561 additions and 45 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def finalize_options(self):
pass

def run(self):
files = glob.glob(os.path.join('subsync', 'gui', '*.fbp'))
files = glob.glob(os.path.join('subsync', 'gui', 'layout', '*.fbp'))
excludeRe = self._mk_pattern('import gettext', '_ = gettext.gettext')

for src in files:
subprocess.check_call([self.wxformbuilder, '-g', src])

dst = src[0:-4] + '_layout.py'
dst = src[0:-4] + '.py'
lines = []

with open(dst, 'r') as fp:
Expand Down Expand Up @@ -151,7 +151,7 @@ def update_version(fname=os.path.join('subsync', 'version.py')):
from setuptools import setup

setup(**desc,
packages=['subsync', 'subsync.assets', 'subsync.data', 'subsync.gui'],
packages=['subsync', 'subsync.assets', 'subsync.data', 'subsync.gui', 'subsync.gui.layout'],
entry_points={'gui_scripts': ['subsync=subsync.__main__:subsync']},
install_requires=['aiohttp', 'pysubs2', 'pycryptodome'],
cmdclass = {
Expand Down
24 changes: 12 additions & 12 deletions subsync/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ PYTHON_PREFIX ?= python
WXFORMBUILDER ?= wxformbuilder

GUI_SRC = \
gui/mainwin.fbp \
gui/subpanel.fbp \
gui/openwin.fbp \
gui/syncwin.fbp \
gui/fpswin.fbp \
gui/channelswin.fbp \
gui/settingswin.fbp \
gui/downloadwin.fbp \
gui/aboutwin.fbp \
gui/errorwin.fbp \
gui/layout/mainwin.fbp \
gui/layout/subpanel.fbp \
gui/layout/openwin.fbp \
gui/layout/syncwin.fbp \
gui/layout/fpswin.fbp \
gui/layout/channelswin.fbp \
gui/layout/settingswin.fbp \
gui/layout/downloadwin.fbp \
gui/layout/aboutwin.fbp \
gui/layout/errorwin.fbp \

GUI_DST = $(GUI_SRC:.fbp=_layout.py)
GUI_DST = $(GUI_SRC:.fbp=.py)


all: gui-gen config.py version.py
Expand All @@ -27,7 +27,7 @@ gui-gen: $(GUI_DST)
gui-gen-clean:
$(RM) $(GUI_DST)

$(GUI_DST): %_layout.py: %.fbp
$(GUI_DST): %.py: %.fbp
$(WXFORMBUILDER) -g $<
$(PYTHON_PREFIX) ../tools/remove_gettext.py $@

Expand Down
4 changes: 2 additions & 2 deletions subsync/gui/aboutwin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import subsync.gui.aboutwin_layout
import subsync.gui.layout.aboutwin
from subsync import img
import wx
import wx.lib.dialogs


class AboutWin(subsync.gui.aboutwin_layout.AboutWin):
class AboutWin(subsync.gui.layout.aboutwin.AboutWin):
def __init__(self, parent):
super().__init__(parent)
img.setItemBitmap(self.m_bitmapLogo, 'logo')
Expand Down
4 changes: 2 additions & 2 deletions subsync/gui/channelswin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import wx
import subsync.gui.channelswin_layout
import subsync.gui.layout.channelswin
from subsync import channels


class ChannelsWin(subsync.gui.channelswin_layout.ChannelsWin):
class ChannelsWin(subsync.gui.layout.channelswin.ChannelsWin):
def __init__(self, parent, audio):
super().__init__(parent)

Expand Down
4 changes: 2 additions & 2 deletions subsync/gui/downloadwin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import subsync.gui.downloadwin_layout
import subsync.gui.layout.downloadwin
from subsync.gui import errorwin
import wx
import sys
Expand All @@ -15,7 +15,7 @@
logger = logging.getLogger(__name__)


class DownloadWin(subsync.gui.downloadwin_layout.DownloadWin):
class DownloadWin(subsync.gui.layout.downloadwin.DownloadWin):
def __init__(self, parent, title, job):
super().__init__(parent)
self.m_textName.SetLabel(title)
Expand Down
4 changes: 2 additions & 2 deletions subsync/gui/errorwin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import wx
import wx.lib.dialogs
import subsync.gui.errorwin_layout
import subsync.gui.layout.errorwin
from subsync import error
import traceback
import sys
Expand All @@ -10,7 +10,7 @@
logger = logging.getLogger(__name__)


class ErrorWin(subsync.gui.errorwin_layout.ErrorWin):
class ErrorWin(subsync.gui.layout.errorwin.ErrorWin):
def __init__(self, parent, msg):
super().__init__(parent)
self.m_textMsg.SetLabel(msg)
Expand Down
4 changes: 2 additions & 2 deletions subsync/gui/fpswin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import subsync.gui.fpswin_layout
import subsync.gui.layout.fpswin
import wx


class FpsWin(subsync.gui.fpswin_layout.FpsWin):
class FpsWin(subsync.gui.layout.fpswin.FpsWin):
def __init__(self, parent, subFps=None, refFps=None):
super().__init__(parent)

Expand Down
Empty file added subsync/gui/layout/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">aboutwin_layout</property>
<property name="file">aboutwin</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
Expand Down
130 changes: 130 additions & 0 deletions subsync/gui/layout/aboutwin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Dec 3 2017)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc


###########################################################################
## Class AboutWin
###########################################################################

class AboutWin ( wx.Dialog ):

def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"About"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )

self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )

bSizer1 = wx.BoxSizer( wx.VERTICAL )

self.m_panelMain = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
fgSizer1 = wx.FlexGridSizer( 0, 1, 0, 0 )
fgSizer1.AddGrowableCol( 0 )
fgSizer1.AddGrowableRow( 0 )
fgSizer1.SetFlexibleDirection( wx.BOTH )
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

fgSizer2 = wx.FlexGridSizer( 1, 0, 0, 0 )
fgSizer2.AddGrowableCol( 0 )
fgSizer2.AddGrowableCol( 1 )
fgSizer2.AddGrowableRow( 0 )
fgSizer2.SetFlexibleDirection( wx.BOTH )
fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

self.m_bitmapLogo = wx.StaticBitmap( self.m_panelMain, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer2.Add( self.m_bitmapLogo, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )

fgSizer3 = wx.FlexGridSizer( 0, 1, 0, 0 )
fgSizer3.SetFlexibleDirection( wx.BOTH )
fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

self.m_staticText5 = wx.StaticText( self.m_panelMain, wx.ID_ANY, _(u"Subtitle\nSpeech\nSynchronizer"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText5.Wrap( -1 )
self.m_staticText5.SetFont( wx.Font( 24, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, wx.EmptyString ) )

fgSizer3.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )

self.m_textVersion = wx.StaticText( self.m_panelMain, wx.ID_ANY, _(u"custom build"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_textVersion.Wrap( -1 )
fgSizer3.Add( self.m_textVersion, 0, wx.BOTTOM|wx.RIGHT|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5 )


fgSizer2.Add( fgSizer3, 1, wx.EXPAND|wx.LEFT, 5 )


fgSizer1.Add( fgSizer2, 1, wx.EXPAND, 50 )


fgSizer1.Add( ( 0, 10), 1, wx.EXPAND, 5 )

self.m_staticText10 = wx.StaticText( self.m_panelMain, wx.ID_ANY, _(u"This is an automatic movie subtitle synchronization tool.\nSynchronization is done by listening to the audio track, translating it if necessary.\nIt could also use another subtitle as a reference.\n\nAuthor: Michał Szymaniak"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText10.Wrap( -1 )
fgSizer1.Add( self.m_staticText10, 0, wx.ALL, 5 )


fgSizer1.Add( ( 0, 10), 1, wx.EXPAND, 5 )

fgSizer3 = wx.FlexGridSizer( 1, 0, 0, 0 )
fgSizer3.AddGrowableCol( 2 )
fgSizer3.SetFlexibleDirection( wx.BOTH )
fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

self.m_buttonLicense = wx.Button( self.m_panelMain, wx.ID_ANY, _(u"License"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer3.Add( self.m_buttonLicense, 0, wx.ALL, 5 )

self.m_buttonCredits = wx.Button( self.m_panelMain, wx.ID_ANY, _(u"Credits"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer3.Add( self.m_buttonCredits, 0, wx.ALL, 5 )

self.m_buttonWebsite = wx.Button( self.m_panelMain, wx.ID_ANY, _(u"Website"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer3.Add( self.m_buttonWebsite, 0, wx.ALL, 5 )


fgSizer3.Add( ( 0, 0), 1, wx.EXPAND, 5 )

self.m_buttonClose = wx.Button( self.m_panelMain, wx.ID_OK, _(u"Close"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_buttonClose.SetDefault()
fgSizer3.Add( self.m_buttonClose, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )


fgSizer1.Add( fgSizer3, 1, wx.EXPAND, 5 )


self.m_panelMain.SetSizer( fgSizer1 )
self.m_panelMain.Layout()
fgSizer1.Fit( self.m_panelMain )
bSizer1.Add( self.m_panelMain, 1, wx.EXPAND |wx.ALL, 5 )


self.SetSizer( bSizer1 )
self.Layout()
bSizer1.Fit( self )

self.Centre( wx.BOTH )

# Connect Events
self.m_buttonLicense.Bind( wx.EVT_BUTTON, self.onButtonLicenseClick )
self.m_buttonCredits.Bind( wx.EVT_BUTTON, self.onButtonCreditsClick )
self.m_buttonWebsite.Bind( wx.EVT_BUTTON, self.onButtonWebsiteClick )

def __del__( self ):
pass


# Virtual event handlers, overide them in your derived class
def onButtonLicenseClick( self, event ):
event.Skip()

def onButtonCreditsClick( self, event ):
event.Skip()

def onButtonWebsiteClick( self, event ):
event.Skip()


Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">channelswin_layout</property>
<property name="file">channelswin</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
Expand Down
103 changes: 103 additions & 0 deletions subsync/gui/layout/channelswin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Dec 3 2017)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc


###########################################################################
## Class ChannelsWin
###########################################################################

class ChannelsWin ( wx.Dialog ):

def __init__( self, parent ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Audio channels"), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )

self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )

bSizer1 = wx.BoxSizer( wx.VERTICAL )

self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
fgSizer1 = wx.FlexGridSizer( 0, 1, 0, 0 )
fgSizer1.SetFlexibleDirection( wx.BOTH )
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Select audio channels to listen to:"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )

self.m_radioAuto = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"auto select"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer1.Add( self.m_radioAuto, 0, wx.EXPAND|wx.ALL, 5 )

self.m_radioAllChannels = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"all channels"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer1.Add( self.m_radioAllChannels, 0, wx.EXPAND|wx.BOTTOM|wx.RIGHT|wx.LEFT, 5 )

self.m_radioCustom = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"custom selection"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_radioCustom.Enable( False )

fgSizer1.Add( self.m_radioCustom, 0, wx.EXPAND|wx.BOTTOM|wx.RIGHT|wx.LEFT, 5 )

self.m_panelCustom = wx.Panel( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
fgSizer3 = wx.FlexGridSizer( 0, 1, 0, 0 )
fgSizer3.SetFlexibleDirection( wx.BOTH )
fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )


self.m_panelCustom.SetSizer( fgSizer3 )
self.m_panelCustom.Layout()
fgSizer3.Fit( self.m_panelCustom )
fgSizer1.Add( self.m_panelCustom, 1, wx.EXPAND|wx.RIGHT|wx.LEFT, 20 )

self.m_staticline1 = wx.StaticLine( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
fgSizer1.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )

fgSizer2 = wx.FlexGridSizer( 1, 0, 0, 0 )
fgSizer2.SetFlexibleDirection( wx.BOTH )
fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

self.m_buttonCancel = wx.Button( self.m_panel1, wx.ID_CANCEL, _(u"Cancel"), wx.DefaultPosition, wx.DefaultSize, 0 )
fgSizer2.Add( self.m_buttonCancel, 0, wx.ALL, 5 )

self.m_buttonOK = wx.Button( self.m_panel1, wx.ID_OK, _(u"OK"), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_buttonOK.SetDefault()
fgSizer2.Add( self.m_buttonOK, 0, wx.ALL, 5 )


fgSizer1.Add( fgSizer2, 1, wx.ALIGN_RIGHT, 5 )


self.m_panel1.SetSizer( fgSizer1 )
self.m_panel1.Layout()
fgSizer1.Fit( self.m_panel1 )
bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )


self.SetSizer( bSizer1 )
self.Layout()
bSizer1.Fit( self )

self.Centre( wx.BOTH )

# Connect Events
self.m_radioAuto.Bind( wx.EVT_RADIOBUTTON, self.onRadioButtonToggle )
self.m_radioAllChannels.Bind( wx.EVT_RADIOBUTTON, self.onRadioButtonToggle )
self.m_radioCustom.Bind( wx.EVT_RADIOBUTTON, self.onRadioButtonToggle )

def __del__( self ):
pass


# Virtual event handlers, overide them in your derived class
def onRadioButtonToggle( self, event ):
event.Skip()




Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">downloadwin_layout</property>
<property name="file">downloadwin</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
Expand Down
Loading

0 comments on commit 81704b8

Please sign in to comment.