All pastes #748398 Raw Edit

Miscellany

public python v1 · immutable
#748398 ·published 2007-10-24 19:51 UTC
rendered paste body
class LoggingTab( gtk.VBox ):    '''This class represent the tab to configure logging'''        def __init__( self, controller ):        '''Contructor'''                gtk.VBox.__init__( self )                self.config = controller.config                self.set_spacing( 12 )     # just to make it look bigger than it is        self.set_border_width( 12 )                 self.saveLogs = gtk.CheckButton( _( 'Save logs automatically' ) )        self.saveLogs.set_active( self.config.user['saveLogsAutomatically'] )                formats = self.config.user['logFormats']        formatsVbox = gtk.VBox()        formatsVbox.set_spacing( 12 )        formatsVbox.set_border_width( 12 )        self.CheckText = gtk.CheckButton( _( 'Text' ) )        self.CheckText.set_active( formats & 1 )        self.CheckHTML = gtk.CheckButton( 'HTML' )        self.CheckHTML.set_active( formats & 2 )        formatsVbox.pack_start( self.CheckText, False, False )        formatsVbox.pack_start( self.CheckHTML, False, False )        formatsFrame = gtk.Frame( _( 'Log Formats' ) )        formatsFrame.add( formatsVbox )        formatsFrameAlig = gtk.Alignment( xscale=1 )        formatsFrameAlig.set_padding( 24, 24, 24, 24 )        formatsFrameAlig.add( formatsFrame )                self.chooser = gtk.FileChooserDialog(title='Select a Directory',action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))                logLabel = gtk.Label( _( '_Log path:' ) )        logLabel.set_use_underline( True )        logLabel.set_mnemonic_widget( self.chooser )        dirchooserbutton = gtk.FileChooserButton(self.chooser)        dirchooserbutton.set_current_folder( self.config.getLogPath() )        pathHbox = gtk.HBox()        pathHbox.pack_start(logLabel, True, True, 0)        pathHbox.pack_start(dirchooserbutton, True, True, 0)                self.pack_start(self.saveLogs, False, False)        self.pack_start(formatsFrameAlig, False, False)        self.pack_start(pathHbox, False, False)                self.show_all()            def save( self ):        '''save the actual setting'''        formats = int(self.CheckText.get_active()) + (int(self.CheckHTML.get_active()) << 1)                self.config.user['saveLogsAutomatically'] = self.saveLogs.get_active()        self.config.user['logFormats'] = formats        self.config.user['logPath'] = self.chooser.get_current_folder()