From c16bed942c5ceaf4bca6e8de483b77a88d4e2d05 Mon Sep 17 00:00:00 2001 From: test Date: Sat, 1 Sep 2012 18:56:22 +0200 Subject: [PATCH] Patches IvolutionTemplate to display images even after install on Ubuntu. Not perfect but better solution still to be found. Also updates MANIFEST.in, tests install and corrects some typos. Discovered that clicking on red cross while processing blocks everything --- MANIFEST.in | 2 -- ivolution/FaceParams.py | 1 + ivolution/gui/IvolutionTemplate.py | 11 +++++++---- ivolution/gui/IvolutionWindow.py | 14 ++++++++------ ivolution/gui/SettingsTemplate.py | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 5c48e19..6df56dc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -recursive-include log * recursive-include doc/build * include LICENSE include README* @@ -6,5 +5,4 @@ include AUTHORS include CHANGES recursive-include ivolution/data/haarcascades * recursive-include ivolution/data/samples * -recursive-include ivolution/data/ui * recursive-include ivolution/data/media * \ No newline at end of file diff --git a/ivolution/FaceParams.py b/ivolution/FaceParams.py index b973b25..11a36ad 100644 --- a/ivolution/FaceParams.py +++ b/ivolution/FaceParams.py @@ -49,6 +49,7 @@ class FaceParams(object): cascade_name = training_types.simple_set[training_type] + ".xml" # Setting up some default parameters for Face Detection + print xml_folder self.face_cascade = cv.Load(os.path.join(xml_folder, cascade_name)) # To be defined more precisely diff --git a/ivolution/gui/IvolutionTemplate.py b/ivolution/gui/IvolutionTemplate.py index d39407e..37135d9 100644 --- a/ivolution/gui/IvolutionTemplate.py +++ b/ivolution/gui/IvolutionTemplate.py @@ -10,6 +10,8 @@ import wx import wx.xrc import wx.aui +import os +from .. import get_data # used to load images and files inputid = 1000 settingsid = 1001 @@ -25,6 +27,7 @@ class IvolutionTemplate ( wx.Frame ): def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 416,471 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) + img_fo = os.path.join("", get_data("media")) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) @@ -61,18 +64,18 @@ class IvolutionTemplate ( wx.Frame ): self.toolbar.SetMinSize( wx.Size( -1,30 ) ) self.toolbar.SetMaxSize( wx.Size( -1,35 ) ) - self.toolbar.AddTool( inputid, u"Input", wx.Bitmap( u"ivolution/data/media/folder_add_48.png", wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) + self.toolbar.AddTool( inputid, u"Input", wx.Bitmap( os.path.join(img_fo, 'folder_add_48.png'), wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) - self.toolbar.AddTool( settingsid, u"Settings", wx.Bitmap( u"ivolution/data/media/spanner_48.png", wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) + self.toolbar.AddTool( settingsid, u"Settings", wx.Bitmap( os.path.join(img_fo, 'spanner_48.png'), wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) self.toolbar.AddSeparator() - self.toolbar.AddTool( startid, u"Go!", wx.Bitmap( u"ivolution/data/media/accepted_48.png", wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) + self.toolbar.AddTool( startid, u"Go!", wx.Bitmap( os.path.join(img_fo, 'accepted_48.png'), wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) - self.toolbar.AddTool( stopid, u"Stop!", wx.Bitmap( u"ivolution/data/media/cancel_48.png", wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) + self.toolbar.AddTool( stopid, u"Stop!", wx.Bitmap( os.path.join(img_fo, 'cancel_48.png'), wx.BITMAP_TYPE_ANY ), wx.NullBitmap, wx.ITEM_NORMAL, wx.EmptyString, wx.EmptyString, None ) self.toolbar.AddSeparator() diff --git a/ivolution/gui/IvolutionWindow.py b/ivolution/gui/IvolutionWindow.py index 5df0107..9b1a686 100644 --- a/ivolution/gui/IvolutionWindow.py +++ b/ivolution/gui/IvolutionWindow.py @@ -27,7 +27,7 @@ from ..util.Notifier import Observable from IvolutionTemplate import IvolutionTemplate from SettingsWindow import SettingsWindow -#from os.path import expanduser # for real home directory + class IvolutionWindow(IvolutionTemplate, Observer, Observable): """ Main Window of the Ivolution application @@ -53,10 +53,12 @@ class IvolutionWindow(IvolutionTemplate, Observer, Observable): self.process_running = False self.facemovie = None - self.inputtextbox.SetLabel(self.in_fo) # sets label to default input folder - self.SetIcon(wx.Icon('ivolution/data/media/vitruve.ico', wx.BITMAP_TYPE_ICO)) # Sets icon + img_fo = os.path.join(self.root_fo, get_data("media")) - self.Show(True) # Finally show the frame + self.inputtextbox.SetLabel(self.in_fo) # sets label to default input folder + self.SetIcon(wx.Icon(os.path.join(img_fo, 'vitruve.ico'), wx.BITMAP_TYPE_ICO)) # Sets icon + + self.Show(True) # Finally shows the frame def get_default_parameters(self): """ @@ -70,8 +72,8 @@ class IvolutionWindow(IvolutionTemplate, Observer, Observable): self.speed = 1 # Speed of the movie self.param = "frontal_face" # type of face profile to be searched for - self.out_fo = os.path.join(self.home_dir, "Videos/") # default output folder - self.in_fo = os.path.join(self.home_dir, "Pictures/") # default input folder + self.out_fo = os.path.join(self.home_dir, "Videos") # default output folder + self.in_fo = os.path.join(self.home_dir, "Pictures") # default input folder # Overriding event handling methods def on_settings(self, event): diff --git a/ivolution/gui/SettingsTemplate.py b/ivolution/gui/SettingsTemplate.py index 9f9b330..6ecdfe2 100644 --- a/ivolution/gui/SettingsTemplate.py +++ b/ivolution/gui/SettingsTemplate.py @@ -130,7 +130,7 @@ class SettingsTemplate ( wx.Frame ): 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 ) + self.modeRadioBox.SetSelection( 1 ) gSizer7.Add( self.modeRadioBox, 0, wx.ALL, 5 ) modeSizer.Add( gSizer7, 1, wx.EXPAND, 5 )