mirror of
https://github.com/jlengrand/Ivolution.git
synced 2026-03-10 08:21:18 +00:00
Settings Window pops up in main wondiw. Start implementing behaviour
This commit is contained in:
BIN
ivolution/data/media/icons/spanner_48.ico
Normal file
BIN
ivolution/data/media/icons/spanner_48.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -25,6 +25,7 @@ from ..util.Notifier import Observer
|
||||
from ..util.Notifier import Observable
|
||||
|
||||
from IvolutionTemplate import IvolutionTemplate
|
||||
from SettingsWindow import SettingsWindow
|
||||
|
||||
|
||||
class IvolutionWindow(IvolutionTemplate, Observer, Observable):
|
||||
@@ -58,7 +59,7 @@ class IvolutionWindow(IvolutionTemplate, Observer, Observable):
|
||||
def get_default_parameters(self):
|
||||
"""
|
||||
"""
|
||||
# FIXME: You gotta try on a Mac
|
||||
# FIXME: Put really general stuff here !
|
||||
self.videospeedlistChoices = [u"slow", u"medium", u"fast"]
|
||||
self.gaugerange = 100
|
||||
|
||||
@@ -72,12 +73,13 @@ class IvolutionWindow(IvolutionTemplate, Observer, Observable):
|
||||
self.out_fo = "C:/Users/jll/Videos/" # Default folder for Windows
|
||||
self.in_fo = "C:\Users\jll\Pictures/"
|
||||
else:
|
||||
self.out_fo = "C:/Users/jll/Videos/" # Default folder for Linux
|
||||
self.out_fo = "/home/jll/Videos/" # Default folder for Linux
|
||||
self.in_fo = "/home/jll/Pictures/"
|
||||
|
||||
# Overriding event handling methods
|
||||
def on_settings(self, event):
|
||||
print "settings"
|
||||
settings = SettingsWindow(self)
|
||||
settings.Show(True) # Finally show the frame
|
||||
|
||||
def on_start(self, event):
|
||||
"""
|
||||
|
||||
219
ivolution/gui_wx/SettingsTemplate.py
Normal file
219
ivolution/gui_wx/SettingsTemplate.py
Normal file
@@ -0,0 +1,219 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
###########################################################################
|
||||
## Python code generated with wxFormBuilder (version Jun 30 2011)
|
||||
## http://www.wxformbuilder.org/
|
||||
##
|
||||
## PLEASE DO "NOT" EDIT THIS FILE!
|
||||
###########################################################################
|
||||
|
||||
import wx
|
||||
import wx.xrc
|
||||
|
||||
###########################################################################
|
||||
## Class SettingsTemplate
|
||||
###########################################################################
|
||||
|
||||
class SettingsTemplate ( wx.Frame ):
|
||||
|
||||
def __init__( self, parent ):
|
||||
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( 342,451 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
|
||||
|
||||
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
|
||||
|
||||
fgSizer4 = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
fgSizer4.AddGrowableCol( 0 )
|
||||
fgSizer4.AddGrowableRow( 0 )
|
||||
fgSizer4.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.m_notebook4 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.basicPage = wx.Panel( self.m_notebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
|
||||
fgSizer5 = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
fgSizer5.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
fgSizer9 = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
fgSizer9.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer9.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.outputLocationTitle = wx.StaticText( self.basicPage, wx.ID_ANY, u"Choose location where the video will be saved: ", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.outputLocationTitle.Wrap( -1 )
|
||||
self.outputLocationTitle.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
fgSizer9.Add( self.outputLocationTitle, 0, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
fgSizer7 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||
fgSizer7.AddGrowableCol( 0 )
|
||||
fgSizer7.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer7.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.outputLocationLabel = wx.StaticText( self.basicPage, wx.ID_ANY, u"C:/Toussa", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.outputLocationLabel.Wrap( -1 )
|
||||
fgSizer7.Add( self.outputLocationLabel, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||
|
||||
self.outputButton = wx.Button( self.basicPage, wx.ID_ANY, u"...", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer7.Add( self.outputButton, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||
|
||||
fgSizer9.Add( fgSizer7, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
self.m_staticline1 = wx.StaticLine( self.basicPage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
|
||||
fgSizer9.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 )
|
||||
|
||||
fgSizer5.Add( fgSizer9, 1, wx.EXPAND, 5 )
|
||||
|
||||
fgSizer10 = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
fgSizer10.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer10.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.OutputName = wx.StaticText( self.basicPage, wx.ID_ANY, u"Choose the name of the generated video:", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.OutputName.Wrap( -1 )
|
||||
self.OutputName.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
fgSizer10.Add( self.OutputName, 0, wx.ALL, 5 )
|
||||
|
||||
fgSizer8 = wx.FlexGridSizer( 1, 2, 0, 0 )
|
||||
fgSizer8.AddGrowableCol( 0 )
|
||||
fgSizer8.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer8.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.outputText = wx.TextCtrl( self.basicPage, wx.ID_ANY, u"Ivolution", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer8.Add( self.outputText, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||
|
||||
self.extentLabel = wx.StaticText( self.basicPage, wx.ID_ANY, u".avi", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.extentLabel.Wrap( -1 )
|
||||
fgSizer8.Add( self.extentLabel, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 10 )
|
||||
|
||||
fgSizer10.Add( fgSizer8, 1, wx.EXPAND, 5 )
|
||||
|
||||
fgSizer5.Add( fgSizer10, 1, wx.EXPAND, 5 )
|
||||
|
||||
self.basicPage.SetSizer( fgSizer5 )
|
||||
self.basicPage.Layout()
|
||||
fgSizer5.Fit( self.basicPage )
|
||||
self.m_notebook4.AddPage( self.basicPage, u"Basic", True )
|
||||
self.advancedPage = wx.Panel( self.m_notebook4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
|
||||
fgSizer11 = wx.FlexGridSizer( 4, 1, 0, 0 )
|
||||
fgSizer11.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer11.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
speedSizer = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
speedSizer.SetFlexibleDirection( wx.BOTH )
|
||||
speedSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.speedLabel = wx.StaticText( self.advancedPage, wx.ID_ANY, u"Choose the speed of the video :", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.speedLabel.Wrap( -1 )
|
||||
self.speedLabel.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
speedSizer.Add( self.speedLabel, 0, wx.ALL, 5 )
|
||||
|
||||
speedComboChoices = [ u"Slow", u"Medium", u"Fast" ]
|
||||
self.speedCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, u"Medium", wx.DefaultPosition, wx.DefaultSize, speedComboChoices, 0 )
|
||||
speedSizer.Add( self.speedCombo, 0, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
fgSizer11.Add( speedSizer, 1, wx.EXPAND, 10 )
|
||||
|
||||
self.m_staticline2 = wx.StaticLine( self.advancedPage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
|
||||
fgSizer11.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
|
||||
|
||||
modeSizer = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
modeSizer.SetFlexibleDirection( wx.BOTH )
|
||||
modeSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.modeLabel = wx.StaticText( self.advancedPage, wx.ID_ANY, u"Choose the mode for processing pictures:", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.modeLabel.Wrap( -1 )
|
||||
self.modeLabel.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
modeSizer.Add( self.modeLabel, 0, wx.ALL, 5 )
|
||||
|
||||
gSizer7 = wx.GridSizer( 1, 2, 0, 0 )
|
||||
|
||||
modeRadioBoxChoices = [ u"Conservative", u"Crop" ]
|
||||
self.modeRadioBox = wx.RadioBox( self.advancedPage, wx.ID_ANY, u"Available modes", wx.DefaultPosition, wx.DefaultSize, modeRadioBoxChoices, 1, wx.RA_SPECIFY_ROWS )
|
||||
self.modeRadioBox.SetSelection( 0 )
|
||||
gSizer7.Add( self.modeRadioBox, 0, wx.ALL, 5 )
|
||||
|
||||
modeSizer.Add( gSizer7, 1, wx.EXPAND, 5 )
|
||||
|
||||
fgSizer11.Add( modeSizer, 1, wx.EXPAND, 5 )
|
||||
|
||||
self.m_staticline3 = wx.StaticLine( self.advancedPage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
|
||||
fgSizer11.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )
|
||||
|
||||
typeSizer = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
typeSizer.SetFlexibleDirection( wx.BOTH )
|
||||
typeSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.typeLabel = wx.StaticText( self.advancedPage, wx.ID_ANY, u"Choose the type of faces for the video :", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.typeLabel.Wrap( -1 )
|
||||
self.typeLabel.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
typeSizer.Add( self.typeLabel, 0, wx.ALL, 5 )
|
||||
|
||||
typeComboChoices = [ u"frontal_face", u"profile_face" ]
|
||||
self.typeCombo = wx.ComboBox( self.advancedPage, wx.ID_ANY, u"frontal_face", wx.DefaultPosition, wx.DefaultSize, typeComboChoices, 0 )
|
||||
typeSizer.Add( self.typeCombo, 0, wx.ALL, 5 )
|
||||
|
||||
fgSizer11.Add( typeSizer, 1, wx.EXPAND, 5 )
|
||||
|
||||
self.m_staticline4 = wx.StaticLine( self.advancedPage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
|
||||
fgSizer11.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
|
||||
|
||||
sortSizer = wx.FlexGridSizer( 2, 1, 0, 0 )
|
||||
sortSizer.SetFlexibleDirection( wx.BOTH )
|
||||
sortSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
self.sortLabel = wx.StaticText( self.advancedPage, wx.ID_ANY, u"Choose the method used to sort images:", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.sortLabel.Wrap( -1 )
|
||||
self.sortLabel.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString ) )
|
||||
|
||||
sortSizer.Add( self.sortLabel, 0, wx.ALL, 5 )
|
||||
|
||||
sortRadioBoxChoices = [ u"FileName", u"EXIF Metadata" ]
|
||||
self.sortRadioBox = wx.RadioBox( self.advancedPage, wx.ID_ANY, u"Available methods", wx.DefaultPosition, wx.DefaultSize, sortRadioBoxChoices, 1, wx.RA_SPECIFY_ROWS )
|
||||
self.sortRadioBox.SetSelection( 0 )
|
||||
sortSizer.Add( self.sortRadioBox, 0, wx.ALL, 5 )
|
||||
|
||||
fgSizer11.Add( sortSizer, 1, wx.EXPAND, 5 )
|
||||
|
||||
self.advancedPage.SetSizer( fgSizer11 )
|
||||
self.advancedPage.Layout()
|
||||
fgSizer11.Fit( self.advancedPage )
|
||||
self.m_notebook4.AddPage( self.advancedPage, u"Advanced", False )
|
||||
|
||||
fgSizer4.Add( self.m_notebook4, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
gSizer4 = wx.GridSizer( 0, 2, 0, 0 )
|
||||
|
||||
self.cancelButton = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
gSizer4.Add( self.cancelButton, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
|
||||
|
||||
self.saveButton = wx.Button( self, wx.ID_ANY, u"Save", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
gSizer4.Add( self.saveButton, 0, wx.ALIGN_BOTTOM|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
|
||||
|
||||
fgSizer4.Add( gSizer4, 1, wx.ALIGN_BOTTOM|wx.EXPAND, 10 )
|
||||
|
||||
self.SetSizer( fgSizer4 )
|
||||
self.Layout()
|
||||
|
||||
self.Centre( wx.BOTH )
|
||||
|
||||
# Connect Events
|
||||
self.outputButton.Bind( wx.EVT_BUTTON, self.on_output )
|
||||
self.cancelButton.Bind( wx.EVT_BUTTON, self.on_cancel )
|
||||
self.saveButton.Bind( wx.EVT_BUTTON, self.on_save )
|
||||
|
||||
def __del__( self ):
|
||||
pass
|
||||
|
||||
|
||||
# Virtual event handlers, overide them in your derived class
|
||||
def on_output( self, event ):
|
||||
event.Skip()
|
||||
|
||||
def on_cancel( self, event ):
|
||||
event.Skip()
|
||||
|
||||
def on_save( self, event ):
|
||||
event.Skip()
|
||||
|
||||
53
ivolution/gui_wx/SettingsWindow.py
Normal file
53
ivolution/gui_wx/SettingsWindow.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
.. module:: SettingsWindow
|
||||
:platform: Unix, Windows, Mac
|
||||
:synopsis: Settings Window of the Ivolution GUI designed to be supported by all platforms.
|
||||
|
||||
.. moduleauthor:: Julien Lengrand-Lambert <jlengrand@gmail.com>
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
import wx.lib.newevent
|
||||
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import webbrowser
|
||||
|
||||
from .. import get_data # used to load images and files
|
||||
|
||||
from SettingsTemplate import SettingsTemplate
|
||||
|
||||
|
||||
class SettingsWindow(SettingsTemplate):
|
||||
"""
|
||||
Settings Window of the Ivolution application
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
Overrides init frame SettingsTemplate
|
||||
"""
|
||||
SettingsTemplate.__init__(self, parent)
|
||||
# TODO : Set icon
|
||||
#self.SetIcon(wx.Icon('ivolution/data/media/icons/spanner_48.ico', wx.BITMAP_TYPE_ICO)) # Sets icon
|
||||
|
||||
self.output_folder = parent.out_fo
|
||||
self.outputLocationLabel.SetLabel(self.output_folder)
|
||||
|
||||
# Virtual event handlers, overide them in your derived class
|
||||
def on_output( self, event ):
|
||||
pass
|
||||
# default_dir = "~/Pictures"
|
||||
# self.inputdialog = wx.DirDialog(self, "Please choose your input directory", style=1, defaultPath=default_dir)
|
||||
|
||||
# if self.inputdialog.ShowModal() == wx.ID_OK:
|
||||
# self.inputtextbox.SetLabel(self.inputdialog.GetPath())
|
||||
# self.inputdialog.Destroy()
|
||||
|
||||
def on_cancel( self, event ):
|
||||
event.Skip()
|
||||
|
||||
def on_save( self, event ):
|
||||
event.Skip()
|
||||
Reference in New Issue
Block a user