def changeNamingStyleLabel(self, widget ) : self.namingStyleComboBoxEntry = self.wTree.get_widget("naming-styleEntry") self.namingStyleLabel = self.wTree.get_widget("naming-styleLabel") Style = self.namingStyleComboBoxEntry.get_text() fileName = FileName( 'dummyName', 'dummyDB') fileName.fileSuffix = '' # generateFileName needs this attribute to be set. aShow = Show( "Black Books", "dummyDuration", "dummyBackend", "dummyUrl" ) aShow.addEpisode( Episode( "2", "Sample Title", "6 November, 2008"), Season("1") ) newLabel = fileName.generateFileName( aShow, Tools.filetypesXML, 'ext3', Style ) self.namingStyleLabel.set_text(newLabel)
def changeNamingStyleLabel(self, widget): self.namingStyleComboBoxEntry = self.wTree.get_widget( "naming-styleEntry") self.namingStyleLabel = self.wTree.get_widget("naming-styleLabel") Style = self.namingStyleComboBoxEntry.get_text() fileName = FileName('dummyName', 'dummyDB') fileName.fileSuffix = '' # generateFileName needs this attribute to be set. aShow = Show("Black Books", "dummyDuration", "dummyBackend", "dummyUrl") aShow.addEpisode(Episode("2", "Sample Title", "6 November, 2008"), Season("1")) newLabel = fileName.generateFileName(aShow, Tools.filetypesXML, 'ext3', Style) self.namingStyleLabel.set_text(newLabel)
def showsNewShowButtonClicked(self, widget): show = Show('', '30', '', '') showDialog = EditShowDialog(show, self.database) result = showDialog.run() self.database.addShow(show) self.database.write() self.showsStore.append([show.name, show.backend, show])
def initPreferences(self): ''' Get values from preferences.xml ''' self.preferences = Preferences(Tools.preferencesXML) self.preferences.load() ## # Set General ## self.namingStyleComboBoxEntry = self.wTree.get_widget( "naming-styleComboBoxEntry") self.namingStyleListstore = gtk.ListStore(str) self.namingStyleComboBoxEntry.set_model(self.namingStyleListstore) self.namingStyleComboBoxEntry.set_text_column(0) for style in self.preferences.getOptions('naming-style'): if style == self.preferences['naming-style']: self.namingStyleListstore.prepend([style]) else: self.namingStyleListstore.append([style]) self.namingStyleEntry = self.wTree.get_widget("naming-styleEntry") self.namingStyleEntry.set_text(self.namingStyleListstore[0][0]) self.namingStyleComboBoxEntry.connect('changed', self.changeNamingStyleLabel) # set example to current preference. self.namingStyleLabel = self.wTree.get_widget("naming-styleLabel") Style = self.namingStyleEntry.get_text() fileName = FileName('dummyName', 'dummyDB') fileName.fileSuffix = '' # generateFileName needs this attribute to be set. aShow = Show("Black Books", "dummyDuration", "dummyBackend", "dummyUrl") aShow.addEpisode(Episode("2", "Sample Title", "6 November, 2008"), Season("1")) newLabel = fileName.generateFileName(aShow, Tools.filetypesXML, 'ext3', Style) self.namingStyleLabel.set_text(newLabel) self.confirmOnRenameCheckButton = self.wTree.get_widget( "confirm-on-renameCheckButton") self.confirmOnRenameCheckButton.set_active( self.to_boolean(self.preferences['confirm-on-rename'])) # Filesystem self.preferencesSelectFilesystemComboBox = self.wTree.get_widget( "preferencesSelectFilesystemComboBox") self.preferencesSelectFilesystemListstore = gtk.ListStore(str) self.preferencesSelectFilesystemComboBox.set_model( self.preferencesSelectFilesystemListstore) for fs in Filesystems(Tools.filetypesXML).loadFilesystems(): if fs.name == self.preferences['filesystem']: self.preferencesSelectFilesystemListstore.prepend([fs.name]) else: self.preferencesSelectFilesystemListstore.append([fs.name]) self.preferencesSelectFilesystemComboBox.set_active(0) self.preferencesEditFilesystemButton = self.wTree.get_widget( "preferencesEditFilesystemButton") self.preferencesEditFilesystemButton.connect('clicked', self.editFilesystem) ## # Set Database ## self.updateOnStartupCheckButton = self.wTree.get_widget( "update-on-startupCheckButton") self.updateOnStartupCheckButton.set_active( self.to_boolean(self.preferences['update-on-startup'])) ## # Set Backends ## self.imdbtvWithTestsCheckButton = self.wTree.get_widget( "imdbtv-with-testsCheckButton") self.imdbtvWithTestsCheckButton.set_active( self.to_boolean(self.preferences['imdbtv-with-tests']))
def initPreferences(self) : ''' Get values from preferences.xml ''' self.preferences = Preferences(Tools.preferencesXML) self.preferences.load() ## # Set General ## self.namingStyleComboBoxEntry = self.wTree.get_widget("naming-styleComboBoxEntry") self.namingStyleListstore = gtk.ListStore(str) self.namingStyleComboBoxEntry.set_model(self.namingStyleListstore) self.namingStyleComboBoxEntry.set_text_column(0) for style in self.preferences.getOptions('naming-style') : if style == self.preferences['naming-style'] : self.namingStyleListstore.prepend([ style ]) else : self.namingStyleListstore.append([ style ]) self.namingStyleEntry = self.wTree.get_widget("naming-styleEntry") self.namingStyleEntry.set_text( self.namingStyleListstore[0][0] ) self.namingStyleComboBoxEntry.connect('changed', self.changeNamingStyleLabel ) # set example to current preference. self.namingStyleLabel = self.wTree.get_widget("naming-styleLabel") Style = self.namingStyleEntry.get_text() fileName = FileName( 'dummyName', 'dummyDB') fileName.fileSuffix = '' # generateFileName needs this attribute to be set. aShow = Show( "Black Books", "dummyDuration", "dummyBackend", "dummyUrl" ) aShow.addEpisode( Episode( "2", "Sample Title", "6 November, 2008"), Season("1") ) newLabel = fileName.generateFileName( aShow, Tools.filetypesXML, 'ext3', Style ) self.namingStyleLabel.set_text(newLabel) self.confirmOnRenameCheckButton = self.wTree.get_widget("confirm-on-renameCheckButton") self.confirmOnRenameCheckButton.set_active( self.to_boolean(self.preferences['confirm-on-rename']) ) # Filesystem self.preferencesSelectFilesystemComboBox = self.wTree.get_widget("preferencesSelectFilesystemComboBox") self.preferencesSelectFilesystemListstore = gtk.ListStore(str) self.preferencesSelectFilesystemComboBox.set_model(self.preferencesSelectFilesystemListstore) for fs in Filesystems(Tools.filetypesXML).loadFilesystems() : if fs.name == self.preferences['filesystem'] : self.preferencesSelectFilesystemListstore.prepend([ fs.name ]) else : self.preferencesSelectFilesystemListstore.append([ fs.name ]) self.preferencesSelectFilesystemComboBox.set_active(0) self.preferencesEditFilesystemButton = self.wTree.get_widget("preferencesEditFilesystemButton") self.preferencesEditFilesystemButton.connect('clicked', self.editFilesystem ) ## # Set Database ## self.updateOnStartupCheckButton = self.wTree.get_widget("update-on-startupCheckButton") self.updateOnStartupCheckButton.set_active( self.to_boolean(self.preferences['update-on-startup']) ) ## # Set Backends ## self.imdbtvWithTestsCheckButton = self.wTree.get_widget("imdbtv-with-testsCheckButton") self.imdbtvWithTestsCheckButton.set_active( self.to_boolean(self.preferences['imdbtv-with-tests']) )