def __check_dest(self,dir): if dir: if not utility().dir_is_empty(dir): self.empty_field(self.parent,label.MUM_ERROR_FOLDER_DEST_NOT_EMPTY ,label.MUM_ERROR_FOLDER_DEST_NOT_EMPTY_DES) return False return True
def __check_source(self,dir): if dir: if not utility().count_img(dir): self.empty_field(self.parent,label.MUM_ERROR_FOLDER_WHITOUT_IMAGES ,label.MUM_ERROR_FOLDER_WHITOUT_IMAGES_DES) return False return True
def __num_op(self): # numero di operazione op_u = utility().count_img(self.source_album) op = op_u*2 op += 3 if self.enable_web: op += op_u*3 op += 30 #upload return op
MUM_FTP_ADDRESS='FTP host:' MUM_FTP_PASSWORD='******' MUM_FTP_USERNAME='******' MUM_ABOUT='About' MUM_RESOLUTION='Resolution:' MUM_ALBUM_THEME='Album theme:' MUM_PUBBLIC='Create ...' MUM_UPDATE_INDEX='Update index.html' MUM_WEB_ROOT="FTP path:" MUM_UPLOAD="Upload on website" MUM_PREVIEW="Preview ..." MUM_SELECT_DIR="Select Folder" MUM_COMPLETED_OPERATION="Operation completed" MUM_STOP_OPERATION="Operation stoped" MUM_ICON_WIN=utility().fix_path(os.path.join(mum_path,'data','mum.ico')) MUM_ICON=utility().fix_path(os.path.join(mum_path,'data','mum.png')) MUM_LABEL_RES=["Low Quality", "Medium Quality", "High Quality"] MUM_TOOLTIP_RES=["Resize at 640x480", "Resize at 800x600", "Resize at 1024x768"] MUM_TITLE_IMAGE=utility().fix_path(os.path.join(mum_path,'data','mum.jpg')) MUM_THEME_LIST=utility().themes(utility().fix_path(os.path.join(mum_path,'template'))) # Error MUM_ERROR_TITLE="Title gallery is empty" MUM_ERROR_FOLDER_IMAGE="Invalid Folder images" MUM_ERROR_FOLDER_DEST="Invalid Folder gallery" MUM_ERROR_FTP_ADDRESS="FTP host is empty" MUM_ERROR_FTP_LOGIN="******"
def __execute(self): """ Launch thread and performe operation """ if self.TitleAlbum.get_text() == '': d = my_call() d.empty_field(self.window,label.MUM_ERROR_TITLE,label.MUM_ERROR_TITLE_DES) self.TitleAlbum.grab_focus() return if not utility().count_img(self.BrowserButtonSource.get_current_folder()): d = my_call() d.empty_field(self.window,label.MUM_ERROR_FOLDER_WHITOUT_IMAGES, label.MUM_ERROR_FOLDER_WHITOUT_IMAGES_DES) self.BrowserButtonSource.grab_focus() return if not os.path.isdir(self.BrowserButtonSource.get_current_folder()): d = my_call() d.empty_field(self.window,label.MUM_ERROR_FOLDER_IMAGE,label.MUM_ERROR_FOLDER_IMAGE_DES) return if not os.path.isdir(self.BrowserButtonDest.get_current_folder()): d = my_call() d.empty_field(self.window,label.MUM_ERROR_FOLDER_DEST,label.MUM_ERROR_FOLDER_DEST_DES) self.BrowserButtonDest.grab_focus() return if not utility().dir_is_empty(self.BrowserButtonDest.get_current_folder()) and not self.__upload_only: d = my_call() d.empty_field(self.window,label.MUM_ERROR_FOLDER_DEST_NOT_EMPTY, label.MUM_ERROR_FOLDER_DEST_NOT_EMPTY_DES) self.BrowserButtonDest.grab_focus() return if self.BrowserButtonDest.get_current_folder() == self.BrowserButtonSource.get_current_folder(): d = my_call() d.empty_field(self.window,label.MUM_ERROR_FOLDER,label.MUM_ERROR_FOLDER_DES) self.BrowserButtonDest.grab_focus() return # show dir have space. if os.path.isdir(self.BrowserButtonDest.get_current_folder()): a, dir =os.path.split(self.BrowserButtonDest.get_current_folder()) if dir.count(' '): d = my_call() d.empty_field(self.window,label.MUM_ERROR_SPACE_IN_FOLDER ,label.MUM_ERROR_SPACE_IN_FOLDER_DES) self.BrowserButtonDest.grab_focus() return if self.checkboxWeb.get_active(): if self.WebUrl.get_text() == '': d = my_call() d.empty_field(self.window,label.MUM_ERROR_FTP_ADDRESS ,label.MUM_ERROR_FTP_ADDRESS_DES) self.WebUrl.grab_focus() return if self.WebLogin.get_text() == '': d = my_call() d.empty_field(self.window,label.MUM_ERROR_FTP_LOGIN ,label.MUM_ERROR_FTP_LOGIN_DES) self.WebLogin.grab_focus() return if self.WebPassword.get_text() == '': d = my_call() d.empty_field(self.window,label.MUM_ERROR_FTP_PASSWORD ,label.MUM_ERROR_FTP_PASSWORD_DES) self.WebPassword.grab_focus() return # re init_thread self.__init_thread() self.th_mum_build.set_theme(self.ListaThemes[self.PreviewMenu.get_active()]) self.th_mum_build.set_resolution(self.ResolutionMenu.get_active()) self.th_mum_build.set_title_album(self.TitleAlbum.get_text()) self.th_mum_build.set_source_album(self.BrowserButtonSource.get_current_folder()) self.th_mum_build.set_dest_album(self.BrowserButtonDest.get_current_folder()) if self.checkboxWeb.get_active(): self.th_mum_build.set_enable_web() self.th_mum_build.set_web_url(self.WebUrl.get_text()) self.th_mum_build.set_web_login(self.WebLogin.get_text()) self.th_mum_build.set_web_password(self.WebPassword.get_text()) self.th_mum_build.set_web_rootdir(self.RootDir.get_text()) if self.CheckUpdateIndex.get_active(): self.th_mum_build.set_enable_update_index() # enalbe upload only if self.__upload_only: self.th_mum_build.set_enable_upload_only() self.Nextbutton.set_label(gtk.STOCK_CANCEL) self.__disable_mum() # busy cursor watch = gtk.gdk.Cursor (gtk.gdk.WATCH) self.window.window.set_cursor(watch) # Ristabilisce il controllo errori self.__handle_error=True # run thread self.th_mum_build.start()