Changeset 241 for trunk


Ignore:
Timestamp:
07/15/07 16:17:47 (5 years ago)
Author:
marc
Message:

Clean up the code to approach PEP-8. Ignore .pyw, only used on builds. Minor translation fixes.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11*.pyc 
         2*.pyw 
        23.project 
        34.~ 
  • trunk/ChangeLog

    r237 r241  
    1 1.0: 
     11.0 (Say no more): 
     2 * Added interface translations #4 
     3 * Switch to GPLv3 
    24 * Added RPM packages 
    3  * Added interface translations #4 
    45 * Simplified and improved Makefile 
    5  * Switch to GPLv3. 
     6 * Cleaning of the code to try to be at least more compatible with PEP-8. 
    67 
    780.2 (I've been watching you...): 
  • trunk/config.py

    r236 r241  
    2121# $Id$ 
    2222 
    23 """ Itaka configuration parser and engine """ 
    24  
    25 # It works by the core initiating the main instance, and the 
    26 # modules accessing the global values variables set up by the initation. 
    27  
    28 import ConfigParser, os, sys, shutil, traceback 
    29  
    30 # Set up instance 
    31 config = ConfigParser.ConfigParser() 
    32  
    33 #: Configuration file 
    34 local_config = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "itaka.conf") 
    35  
    36 #: Version 
    37 version = '1.0' 
    38 #: SVN Revision 
    39 revision = '$Rev$' 
    40  
    41 #: System 
     23""" Itaka configuration engine """ 
     24 
     25__version__ = '1.0' 
     26__revision__ = '$Rev$' 
     27 
     28import os 
     29import sys 
     30import ConfigParser 
     31import shutil 
     32import traceback 
     33 
     34#: Availability of libnotify 
     35notify_available = False 
     36 
     37try: 
     38    import pynotify 
     39    notify_available = True 
     40 
     41    if not pynotify.init('Itaka'): 
     42        print_warning(_('Pynotify module is failing, disabling notifications')) 
     43        notify_available = False 
     44except ImportError: 
     45    print_warning(_('Pynotify module is missing, disabling notifications')) 
     46    notify_available = False 
     47 
     48config_instance = ConfigParser.ConfigParser() 
     49image_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'share/images/') 
    4250system = os.name 
    4351 
    44 #: Platform 
    45 platform = None 
    46 if (sys.platform.startswith('darwin')): platform = 'darwin' 
    47  
    48 #: Images directory 
    49 image_dir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'share/images/') 
    50  
    5152#: To be changed on install to specify where the installed files actually are 
    52 prefix = '/usr/share/itaka/images/' 
    53 if os.path.exists(prefix): 
     53image_prefix = '/usr/share/itaka/images/' 
     54if os.path.exists(image_prefix): 
    5455    image_dir = prefix 
    5556 
    56 # See if our images are there before starting 
    5757if not os.path.exists(image_dir): 
    5858    print_error(_('Could not find images directory %s' % (image_dir))) 
     
    6161#: Save path for screenshots (system-specific specified later on) 
    6262save_path = os.getcwd() 
     63 
     64""" Console output verbosity 
     65'normal' is for all normal operation mesages and warnings (not including errors) 
     66'debug' is for all messages through self.console.debug 
     67'quiet' is to quiet all errors and warnings. (totally quiet is in conjunction  
     68with 'normal' = False, which quiets normal messages too) 
     69""" 
     70console_verbosity = {'normal': False, 'debug': False, 'quiet': False} 
     71 
     72#: Globally acessable configuration values 
     73configuration_values = {} 
    6374 
    6475if os.environ.get('HOME'): 
     
    6778    save_path = os.environ.get('TMP') or os.environ.get('TEMP') 
    6879 
    69 #: Availability of libnotify 
    70 notifyavailable = False 
    71  
    72 if system == 'posix' and platform != 'darwin': 
    73     try: 
    74         import pynotify 
    75         notifyavailable = True 
    76  
    77         if not pynotify.init('Itaka'): 
    78             print_warning(_('Pynotify module is failing, disabling notifications')) 
    79             notifyavailable = False 
    80     except ImportError: 
    81         print_warning(_('Pynotify module is missing, disabling notifications')) 
    82         notifyavailable = False 
    83  
    84 #: Console output setting 
    85 # 'normal' is for all normal operation mesages and warnings (not including errors) 
    86 # 'debug' is for all messages through self.console.debug 
    87 # 'quiet' is to quiet all errors and warnings. (totally quiet is in conjunction with 'normal') 
    88 output = {'normal': False, 'debug': False, 'quiet': False} 
    89  
    90 #: User's configuration values  
    91 values = {} 
    92  
    93 #: Default HTML header. 
     80#: Default HTML headers and footers for the server. 
    9481# Putting <meta http-equiv="Refresh" content="5; url=http://localhost:8000"> is very useful for debugging 
    95 headhtml = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
     82head_html = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
    9683<html> 
    9784<head> 
     
    10390''' 
    10491 
    105 #: Default HTML footer. 
    106 footerhtml = ''' 
     92footer_html = ''' 
    10793</div> 
    10894</body> 
     
    116102    def __init__(self, arguments=None): 
    117103        """ 
    118         Configuration engine constructor. It also handles whether the L{output} setting is set to print everything to the console 
     104        Configuration engine constructor. It also handles whether the 
     105        L{console_verbosity} setting is set to debug. 
    119106 
    120107        @type arguments: tuple 
    121108        @param arguments: A tuple of sys.argv  
    122109        """ 
     110 
    123111        if arguments is not None and len(arguments) > 1 and arguments[-1] == '-debug': 
    124             global output 
    125             output = {'normal': True, 'debug': True, 'quiet': False} 
     112            global console_verbosity 
     113            console_verbosity = {'normal': True, 'debug': True, 'quiet': False} 
    126114            print_m(_('Initializing in debug mode')) 
    127115 
    128116        #: Default configuration sections and values 
    129         self.defaultoptions = (  
    130                 {'server': (('port', 8000), ('authentication', False), ('username', 'user'), ('password', 'password'), ('notify', notifyavailable))}, 
    131                 {'screenshot': (('format', 'jpeg'), ('quality', 30), ('path', save_path), ('currentwindow', False), ('scale', False), ('scalepercent', 100))}, 
    132                 {'html': (('html', '<img src="screenshot" alt="If you are seeing this message it means there was an error in Itaka or you are using a text-only browser.">'), ('authfailure', '<p><strong>Sorry, but you cannot access this resource without authorization.</strong></p>'))} 
    133                 ) 
     117        self.default_options = (  
     118                {'server': ( 
     119                    ('port', 8000), ('authentication', False), 
     120                    ('username', 'user'), ('password', 'password'), 
     121                    ('notify', notify_available) 
     122                )}, 
     123 
     124                {'screenshot': ( 
     125                    ('format', 'jpeg'), ('quality', 30), ('path', save_path), 
     126                    ('currentwindow', False), ('scale', False), 
     127                    ('scalepercent', 100) 
     128                )}, 
     129                 
     130                {'html': ( 
     131                    ('html', '<img src="screenshot" alt="If you are seeing this message it means there was an error in Itaka or you are using a text-only browser.">'), 
     132                    ('authfailure', '<p><strong>Sorry, but you cannot access this resource without authorization.</strong></p>') 
     133                )} 
     134        ) 
    134135 
    135136    def load(self): 
     
    141142        """ 
    142143 
    143         self.configfile = None 
     144        self.config_file = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "itaka.conf") 
     145 
     146        global configuration_values 
     147        configuration_values = {} 
    144148 
    145149        # Check routine 
     
    148152                self.create(os.path.join(os.environ['HOME'], '.itaka/itaka.conf')) 
    149153            else: 
    150                 self.configfile = os.path.join(os.environ['HOME'], '.itaka/itaka.conf') 
     154                self.config_file = os.path.join(os.environ['HOME'], '.itaka/itaka.conf') 
    151155        elif (system == 'nt'): 
    152156            if not (os.path.exists(os.path.join(os.environ['APPDATA'], 'itaka/itaka.ini'))): 
    153157                self.create(os.path.join(os.environ['APPDATA'], 'itaka/itaka.ini')) 
    154158            else: 
    155                 self.configfile = os.path.join(os.environ['APPDATA'], 'itaka/itaka.ini') 
     159                self.config_file = os.path.join(os.environ['APPDATA'], 'itaka/itaka.ini') 
    156160        else: 
    157             # Generic system/paths (using local)         
    158             if (os.path.exists(local_config)):  
    159                 self.configfile = local_config 
    160             else:        
    161                 self.create(local_config) 
     161            # Generic path 
     162            if not os.path.exists(self.config_file):  
     163                self.create(self.config_file) 
     164 
    162165        # Read and assign values from the configuration file  
    163166        try: 
    164             config.read(self.configfile) 
    165             if output['normal']:  
    166                 print_m(_('Loaded configuration %s' % (self.configfile))) 
     167            config_instance.read(self.config_file) 
     168            if console_verbosity['normal']:  
     169                print_m(_('Loaded configuration %s' % (self.config_file))) 
    167170 
    168171        except: 
    169             if output['normal']: print_error(_('Could not read configuration file (%s)' % (self.configfile))) 
    170             if output['debug']: traceback.print_exc() 
    171  
    172         """ Retrieve values and return them as a dict """ 
    173         global values 
    174         values = {} 
     172            if console_verbosity['normal']: print_error(_('Could not read configuration file (%s)' % (self.config_file))) 
     173            if console_verbosity['debug']: traceback.print_exc() 
     174 
    175175        # Get values as a dict and return it 
    176         for section in config.sections(): 
    177             values[section] = dict(config.items(section)) 
     176        for section in config_instance.sections(): 
     177            configuration_values[section] = dict(config_instance.items(section)) 
    178178            # Convert 'False' and 'True' into booleans, and numbers into ints 
    179179            # Add config options that are not there 
    180             for option, value in values[section].iteritems(): 
     180            for option, value in configuration_values[section].iteritems(): 
    181181                if value.strip() == 'True': 
    182                     values[section][option] = True 
     182                    configuration_values[section][option] = True 
    183183                elif value.strip() == 'False': 
    184                     values[section][option] = False 
     184                    configuration_values[section][option] = False 
    185185                elif value.isdigit(): 
    186                     values[section][option] = int(value) 
     186                    configuration_values[section][option] = int(value) 
    187187 
    188188        # Compare it to our default configuration set, to see if there is anything missing 
     
    191191        # dont have to reload 
    192192        brokenwarning = False 
    193         for configdict in self.defaultoptions: 
     193        for configdict in self.default_options: 
    194194            for section in configdict: 
    195                 if not values.has_key(section): 
    196                     if not output['quiet'] and not brokenwarning:  
     195                if not configuration_values.has_key(section): 
     196                    if not console_verbosity['quiet'] and not brokenwarning:  
    197197                        print_warning(_('Detected old or broken configuration file. Fixing')) 
    198198                        brokenwarning = True 
    199                     config.add_section(section) 
    200                     values[section] = {} 
     199                    config_instance.add_section(section) 
     200                    configuration_values[section] = {} 
    201201                    for keyset in configdict[section]: 
    202202                        key, val = keyset 
    203203                        self.update(section, key, val) 
    204                         values[section][key] = val 
     204                        configuration_values[section][key] = val 
    205205                else: 
    206206                    # Check if all the key:vals are in the section 
    207207                    for keyset in configdict[section]: 
    208208                        key, val = keyset 
    209                         if not values[section].has_key(key): 
    210                             if not output['quiet'] and not brokenwarning: 
     209                        if not configuration_values[section].has_key(key): 
     210                            if not console_verbosity['quiet'] and not brokenwarning: 
    211211                                print_warning(_('Detected old or broken configuration file. Fixing')) 
    212212                            self.update(section, key, val) 
    213                             values[section][key] = val 
     213                            configuration_values[section][key] = val 
    214214                            brokenwarning = True 
    215         return values 
     215        return configuration_values 
    216216 
    217217    def save(self, valuesdict): 
     
    226226        for section in valuesdict.keys(): 
    227227            for key, value in valuesdict[section].items(): 
    228                 config.set(section, key, value) 
     228                config_instance.set(section, key, value) 
    229229 
    230230        # Save 
    231231        try: 
    232             config.write(open(self.configfile, 'w')) 
    233             if output['normal']: print_m(_('Saving configuration'))      
     232            config_instance.write(open(self.config_file, 'w')) 
     233            if console_verbosity['normal']: print_m(_('Saving configuration'))   
    234234        except:          
    235             if not output['quiet']: print_error(_('Could not write configuration file %s' % (self.configfile))) 
    236             if output['debug']: traceback.print_exc() 
     235            if not console_verbosity['quiet']: print_error(_('Could not write configuration file %s' % (self.config_file))) 
     236            if console_verbosity['debug']: traceback.print_exc() 
    237237 
    238238    def update(self, section, key, value): 
    239239        """  
    240240        Update a specific key's value 
    241          
     241 
    242242        @type section: str 
    243243        @param section: String of the section of the key to update 
     
    247247        @param value: Value of the key to update 
    248248        """      
    249          
    250         config.set(section, key, value) 
    251          
    252         try: 
    253             config.write(open(self.configfile, 'w')) 
    254             if output['debug']: print_m(_('Updating configuration key %s to %s' % (key, value)))         
     249 
     250        config_instance.set(section, key, value) 
     251 
     252        try: 
     253            config_instance.write(open(self.config_file, 'w')) 
     254            if console_verbosity['debug']: print_m(_('Updating configuration key %s to %s' % (key, value)))      
    255255        except: 
    256             if not output['quiet']: print_error(_('Could not write configuration file %s' % (self.configfile))) 
    257             if output['debug']: traceback.print_exc() 
     256            if not console_verbosity['quiet']: print_error(_('Could not write configuration file %s' % (self.config_file))) 
     257            if console_verbosity['debug']: traceback.print_exc() 
    258258 
    259259    def create(self, path): 
    260260        """ 
    261261        Create a configuration file from default values 
    262          
     262 
    263263        @type path: str 
    264264        @param path: Path to the configuration file 
    265265        """ 
    266          
    267         if output['normal']: print_m(_('Creating default configuration')) 
     266 
     267        if console_verbosity['normal']: print_m(_('Creating default configuration')) 
    268268 
    269269        # Set default sections and options 
    270         for configdict in self.defaultoptions: 
     270        for configdict in self.default_options: 
    271271            for section in configdict: 
    272                 config.add_section(section) 
     272                config_instance.add_section(section) 
    273273                for keyset in configdict[section]: 
    274274                    key, val = keyset 
    275                     config.set(section, key, val) 
    276  
    277         # Check if the directory exists, if not create it 
    278         # and write the config file with its variables 
     275                    config_instance.set(section, key, val) 
     276 
    279277        if not (os.path.exists(os.path.dirname(path))): 
    280278            shutil.os.mkdir(os.path.dirname(path)) 
    281279 
    282280        try: 
    283             config.write(open(path, 'w')) 
     281            config_instance.write(open(path, 'w')) 
    284282        except: 
    285             if not output['quiet']: print_error(_('Could not write configuration file %s' % (path))) 
    286             if output['debug']: traceback.print_exc() 
    287  
    288         self.configfile = path           
     283            if not console_verbosity['quiet']: print_error(_('Could not write configuration file %s' % (path))) 
     284            if console_verbosity['debug']: traceback.print_exc() 
     285 
     286        self.config_file = path  
  • trunk/console.py

    r236 r241  
    125125    """ 
    126126 
    127     def __init__(self, itakaglobals): 
     127    def __init__(self, itaka_globals): 
    128128        """ 
    129129        Constructor for console output handler 
    130130         
    131131        @type itakaglobals: module 
    132         @param itakaglobals: Configuration module 
     132        @param itakaglobals: Configuration module globals 
    133133        """ 
    134134 
    135         self.itakaglobals = itakaglobals 
    136         if self.itakaglobals.output['normal']:  
     135        self.itaka_globals = itaka_globals 
     136        if self.itaka_globals.console_verbosity['normal']:  
    137137            BaseMessage(_('Itaka %s starting') % (itakaglobals.version)) 
    138138             
     
    142142        """ 
    143143         
    144         if self.itakaglobals.output['normal']:  
     144        if self.itaka_globals.console_verbosity['normal']:  
    145145            BaseMessage(_('Itaka shutting down')) 
    146146 
     
    153153        """ 
    154154         
    155         if self.itakaglobals.output['normal']: 
     155        if self.itaka_globals.console_verbosity['normal']: 
    156156            BaseMessage(message) 
    157157 
    158     def failure(self, caller, message, failuretype='ERROR'): 
     158    def failure(self, caller, message, failure_type='ERROR'): 
    159159        """ 
    160160        Failure handler abstract 
     
    166166        @param message: Message to print to the console 
    167167 
    168         @type failuretype: str 
    169         @param failuretype: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
     168        @type failure_type: str 
     169        @param failure_type: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
    170170        """ 
    171171 
    172         if failuretype == 'ERROR': 
    173             if not self.itakaglobals.output['quiet']: 
    174                 BaseFailureMessage(self.itakaglobals.output['quiet'], caller, message, failuretype) 
     172        if failure_type == 'ERROR': 
     173            if not self.itaka_globals.console_verbosity['quiet']: 
     174                BaseFailureMessage(self.itaka_globals.console_verbosity['quiet'], caller, message, failure_type) 
    175175 
    176         elif failuretype == 'WARNING': 
    177             if self.itakaglobals.output['normal']: 
    178                 BaseFailureMessage(self.itakaglobals.output['normal'], caller, message, failuretype) 
     176        elif failure_type == 'WARNING': 
     177            if self.itaka_globals.console_verbosity['normal']: 
     178                BaseFailureMessage(self.itaka_globals.console_verbosity['normal'], caller, message, failure_type) 
    179179 
    180         elif failuretype == 'DEBUG': 
    181             if self.itakaglobals.output['debug']: 
    182                 BaseFailureMessage(self.itakaglobals.output['debug'], caller, message, failuretype) 
     180        elif failure_type == 'DEBUG': 
     181            if self.itaka_globals.console_verbosity['debug']: 
     182                BaseFailureMessage(self.itaka_globals.console_verbosity['debug'], caller, message, failure_type) 
    183183 
  • trunk/debian

    • Property svn:ignore
      •  

        old new  
        11*.pyc 
         2*.pyw 
        23.project 
        34.~ 
  • trunk/itaka.py

    r237 r241  
    2323""" Itaka core """ 
    2424 
    25 import sys, os, traceback, gettext, locale, __builtin__ 
     25import sys 
     26import os 
     27import traceback 
     28import gettext 
     29import locale 
     30import __builtin__ 
     31 
    2632locale.setlocale(locale.LC_ALL, '') 
    2733__builtin__._ = gettext.gettext 
    2834 
    29 # Itaka core modules 
     35# Itaka modules 
    3036try: 
    3137    import console 
    32     import config as itakaglobals 
     38    import config as itaka_globals 
    3339    import uigtk as igui 
    3440except ImportError: 
     
    3642    traceback.print_exc() 
    3743    sys.exit(1) 
    38  
    3944 
    4045#: Locales directory 
     
    5459    gettext.textdomain('itaka') 
    5560 
    56 validarguments = ('-help', '-debug') 
     61valid_arguments = ('-help', '-debug') 
    5762arguments = sys.argv 
    5863 
    5964# Only one option at a time 
    60 if len(arguments) > 2 or (len(arguments) == 2 and arguments[-1] not in validarguments or arguments[-1] == validarguments[0]): 
     65if len(arguments) > 2 or (len(arguments) == 2 and arguments[-1] \ 
     66        not in valid_arguments or arguments[-1] == valid_arguments[0]): 
    6167    print _('Usage: %s (-debug|-help)') % (arguments[0]) 
    6268    sys.exit(1) 
     
    6672try: 
    6773    # Initiate our Console and Configuration engines 
    68     configinstance = itakaglobals.ConfigParser(arguments) 
    69     configinstance.load() 
     74    config_instance = itaka_globals.ConfigParser(arguments) 
     75    config_instance.load() 
    7076 
    7177    try: 
    72         # Initiate console with a reference to our global configuration values 
    73         console = console.Console(itakaglobals) 
     78        # Initiate console with a reference to our global configuration values, 
     79        # not the user's configuration 
     80        console_instance = console.Console(itaka_globals) 
    7481    except: 
    7582        print_error(_('Could not initiate Console engine')) 
     
    8390if __name__ == "__main__": 
    8491    try: 
    85         gui = igui.Gui(console, (itakaglobals, configinstance)) 
     92        gui = igui.Gui(console_instance, (itaka_globals, config_instance)) 
    8693        gui.main() 
    8794    except Exception, e: 
    88         console.failure(('Itaka', 'core'), _('Could not initiate GUI: %s') % (e), 'ERROR') 
    89         if itakaglobals.output['debug']: 
     95        console_instance.failure(('Itaka', 'core'), _('Could not initiate GUI: %s') % (e), 'ERROR') 
     96        if itaka_globals.console_verbosity['debug']: 
    9097            traceback.print_exc() 
    9198        sys.exit(1) 
  • trunk/locale

    • Property svn:ignore set to
      *.pyc
      *.pyw
      .project
      .~
      *.pida
      *.bak
      .*.swp
      .*.swo
      .DS_Store
  • trunk/locale/es

    • Property svn:ignore set to
      *.pyc
      *.pyw
      .project
      .~
      *.pida
      *.bak
      .*.swp
      .*.swo
      .DS_Store
  • trunk/locale/es/LC_MESSAGES

    • Property svn:ignore set to
      *.pyc
      *.pyw
      .project
      .~
      *.pida
      *.bak
      .*.swp
      .*.swo
      .DS_Store
  • trunk/locale/es/LC_MESSAGES/itaka.po

    r238 r241  
    297297#: uigtk.py:1008 
    298298msgid "Logging paused" 
    299 msgstr "Registro detuvido" 
     299msgstr "Registro detenido" 
    300300 
    301301#: uigtk.py:1030 
  • trunk/screenshot.py

    r236 r241  
    2323""" Itaka screenshot engine """ 
    2424 
    25 import gc, os, gtk, pygtk, error, traceback 
     25import gc 
     26import os 
     27import gtk 
     28import pygtk 
    2629pygtk.require("2.0") 
     30import error 
     31import traceback 
    2732 
    2833class Screenshot: 
     
    3136    """ 
    3237 
    33     def __init__(self, guiinstance, scalingmethod=gtk.gdk.INTERP_BILINEAR):  
     38    def __init__(self, gui_instance, scaling_method=gtk.gdk.INTERP_BILINEAR):  
    3439        """ 
    3540        Constructor 
    3641 
    37         @type scalingmethod: gtk.gdk.INTERP_TYPE 
    38         @param scalingmethod: A type of interpolation for screenshot scaling. U{http://pygtk.org/pygtk2reference/class-gdkpixbuf.html#method-gdkpixbuf--scale-simple} 
     42        @type scaling_method: gtk.gdk.INTERP_TYPE 
     43        @param scaling_method: A type of interpolation for screenshot scaling. U{http://pygtk.org/pygtk2reference/class-gdkpixbuf.html#method-gdkpixbuf--scale-simple} 
    3944 
    40         @type guiinstance: instance 
    41         @param guiinstance: An instance of our L{Gui} class 
     45        @type gui_instance: instance 
     46        @param gui_instance: An instance of our L{Gui} class 
    4247        """ 
    4348 
    44         self.gui = guiinstance 
    45         self.itakaglobals = self.gui.itakaglobals 
     49        self.gui = gui_instance 
     50        self.itaka_globals = self.gui.itaka_globals 
    4651        self.configuration = self.gui.configuration 
    4752        self.console = self.gui.console 
    48         self.scalingmethod = scalingmethod 
     53        self.scaling_method = scaling_method 
    4954 
    5055        #: Whether our current window method failed or not 
    51         self.currentwindowfailed = False 
     56        self.current_window_failed = False 
    5257 
    5358        #: Final absolute path to the screenshot file 
    54         self.shotFile = os.path.join(self.configuration['screenshot']['path'], 'itakashot.%s' % (self.configuration['screenshot']['format'])) 
     59        self.shot_file = os.path.join(self.configuration['screenshot']['path'], 'itakashot.%s' % (self.configuration['screenshot']['format'])) 
    5560         
    56         self.rootscreen = gtk.gdk.screen_get_default() 
    57         self.rootwindow = gtk.gdk.get_default_root_window() 
     61        self.root_screen = gtk.gdk.screen_get_default() 
     62        self.root_window = gtk.gdk.get_default_root_window() 
    5863 
    59         self.screenwidth = gtk.gdk.screen_width() 
    60         self.screenheight = gtk.gdk.screen_height() 
     64        self.screen_width = gtk.gdk.screen_width() 
     65        self.screen_height = gtk.gdk.screen_height() 
    6166 
    6267    def find_current_active_window(self): 
     
    6873        """ 
    6974 
    70         if self.rootscreen.supports_net_wm_hint("_NET_ACTIVE_WINDOW") and self.rootscreen.supports_net_wm_hint("_NET_WM_WINDOW_TYPE"): 
    71             self.activewindow = self.rootscreen.get_active_window() 
     75        if self.root_screen.supports_net_wm_hint("_NET_ACTIVE_WINDOW") and \ 
     76            self.root_screen.supports_net_wm_hint("_NET_WM_WINDOW_TYPE"): 
     77            self.active_window = self.root_screen.get_active_window() 
    7278 
    7379            # Calculate the size of the window including window manager decorations 
    74             self.relativex, self.relativey, self.winw, self.winh, self.d = self.activewindow.get_geometry()  
    75             self.windowwidth = self.winw + (self.relativex*2) 
    76             self.windowheight = self.winh + (self.relativey+self.relativex) 
     80            self.relativex, self.relativey, self.winw, self.winh, self.d = self.active_window.get_geometry()  
     81            self.window_width = self.winw + (self.relativex*2) 
     82            self.window_height = self.winh + (self.relativey+self.relativex) 
    7783 
    7884            # Calculate the position of where the window manager decorations start 
    7985            # get_position() will return the position of the window relative to the WM 
    80             self.windowpositionx, self.windowpositiony = self.activewindow.get_root_origin() 
     86            self.window_positionx, self.window_positiony = self.active_window.get_root_origin() 
    8187        else: 
    82             self.currentwindowfailed = True 
     88            self.current_window_failed = True 
    8389            raise error.ItakaScreenshotErrorWmHints, _('Window Manager does not support _NET_WM hints') 
    8490     
    8591        # We do not want to grab the desktop window 
    86         if self.activewindow.property_get("_NET_WM_WINDOW_TYPE")[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP': 
    87             self.currentwindowfailed = True 
     92        if self.active_window.property_get("_NET_WM_WINDOW_TYPE")[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP': 
     93            self.current_window_failed = True 
    8894            raise error.ItakaScreenshotErrorActiveDesktop, _('Active window is desktop') 
    8995 
    90         return (self.windowwidth, self.windowheight, self.windowpositionx, self.windowpositiony) 
     96        return (self.window_width, self.window_height, self.window_positionx, self.window_positiony) 
    9197 
    9298    def take_screenshot(self): 
     
    95101 
    96102        @rtype: str 
    97         @return: Path to the screenshot (L{self.shotFile}) 
     103        @return: Path to the screenshot (L{self.shot_file}) 
    98104        """ 
    99105 
     
    102108        self.configuration = self.gui.configuration 
    103109 
    104         if self.configuration['screenshot']['currentwindow'] and not self.itakaglobals.system == 'nt': 
     110        if self.configuration['screenshot']['currentwindow'] and not self.itaka_globals.system == 'nt': 
    105111            try: 
    106                 self.currentwindow = self.find_current_active_window() 
     112                self.current_window = self.find_current_active_window() 
    107113            except error.ItakaScreenshotErrorWmHints: 
    108114                self.gui.log.failure(('Screenshot', 'take_screenshot'), (_('Can not grab the current window'), _('Can not grab the current window because your window manager does not support NET_WM_* hints')), 'WARNING') 
     
    110116                self.gui.log.failure(('Screenshot', 'take_screenshot'), (_('Not grabing the desktop as the current window'), _('Your focus was on the destop when a client requested a screenshot, Itaka instead took a screenshot of the whole screen')), 'WARNING') 
    111117 
    112             if not self.currentwindowfailed: 
     118            if not self.current_window_failed: 
    113119                # Make the window size also the screen size for scaling purposes 
    114                 self.activewindowwidth = self.currentwindow[0] 
    115                 self.activewindowheight = self.currentwindow[1] 
     120                self.active_windowwidth = self.current_window[0] 
     121                self.active_windowheight = self.current_window[1] 
    116122 
    117123                self.screenshot = gtk.gdk.Pixbuf.get_from_drawable( 
    118                         gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, self.activewindowwidth, self.activewindowheight), 
    119                         self.rootwindow, 
     124                        gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, self.active_windowwidth, self.active_windowheight), 
     125                        self.root_window, 
    120126                        gtk.gdk.colormap_get_system(), 
    121                         self.currentwindow[2], self.currentwindow[3], 0, 0, self.activewindowwidth, self.activewindowheight) 
     127                        self.current_window[2], self.current_window[3], 0, 0, self.active_windowwidth, self.active_windowheight) 
    122128 
    123         if self.currentwindowfailed or not self.configuration['screenshot']['currentwindow'] or self.itakaglobals.system == 'nt':  
     129        if self.current_window_failed or not self.configuration['screenshot']['currentwindow'] or self.itaka_globals.system == 'nt':  
    124130            self.screenshot = gtk.gdk.Pixbuf.get_from_drawable( 
    125                     gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, self.screenwidth, self.screenheight), 
    126                     self.rootwindow, 
     131                    gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, self.screen_width, self.screen_height), 
     132                    self.root_window, 
    127133                    gtk.gdk.colormap_get_system(), 
    128                     0, 0, 0, 0, self.screenwidth, self.screenheight) 
     134                    0, 0, 0, 0, self.screen_width, self.screen_height) 
    129135 
    130136        # GTK manages errors this way 
    131137        if not hasattr(self, 'screenshot') or self.screenshot is None: 
    132138            # Reset the failure flag 
    133             self.currentwindowfailed = False 
     139            self.current_window_failed = False 
    134140            self.gui.log.failure(('Screenshot', 'take_screenshot'), (_('Could not grab screenshot'), _('GTK+ could not grab a screenshot of the screen')), 'ERROR') 
    135141            raise error.ItakaScreenshotError, _('Could not grab screenshot, GTK+ error') 
     
    140146                self.configuration['screenshot']['scalepercent'] = 1 
    141147 
    142             if self.configuration['screenshot']['currentwindow'] and not self.currentwindowfailed and not self.itakaglobals.system == 'nt': 
    143                 self.scalewidth = self.activewindowwidth * int(self.configuration['screenshot']['scalepercent']) / 100 
    144                 self.scaleheight = self.activewindowheight * int(self.configuration['screenshot']['scalepercent']) / 100 
     148            if self.configuration['screenshot']['currentwindow'] and not self.current_window_failed and not self.itaka_globals.system == 'nt': 
     149                self.scale_width = self.active_windowwidth * int(self.configuration['screenshot']['scalepercent']) / 100 
     150                self.scale_height = self.active_windowheight * int(self.configuration['screenshot']['scalepercent']) / 100 
    145151            else: 
    146                 self.scalewidth = self.screenwidth * int(self.configuration['screenshot']['scalepercent']) / 100 
    147                 self.scaleheight = self.screenheight * int(self.configuration['screenshot']['scalepercent']) / 100 
    148             self.screenshot = self.screenshot.scale_simple(self.scalewidth, self.scaleheight, self.scalingmethod) 
     152                self.scale_width = self.screen_width * int(self.configuration['screenshot']['scalepercent']) / 100 
     153                self.scale_height = self.screen_height * int(self.configuration['screenshot']['scalepercent']) / 100 
     154            self.screenshot = self.screenshot.scale_simple(self.scale_width, self.scale_height, self.scaling_method) 
    149155 
    150156        # Save the screnshot, checking before if to set JPEG quality 
    151157        try: 
    152158            if self.configuration['screenshot']['format'] == 'jpeg': 
    153                 self.screenshot.save(self.shotFile, self.configuration['screenshot']['format'].lower(), {"quality":str(self.configuration['screenshot']['quality'])}) 
     159                self.screenshot.save(self.shot_file, self.configuration['screenshot']['format'].lower(), {"quality":str(self.configuration['screenshot']['quality'])}) 
    154160            else: 
    155                 self.screenshot.save(self.shotFile, self.configuration['screenshot']['format'].lower()) 
     161                self.screenshot.save(self.shot_file, self.configuration['screenshot']['format'].lower()) 
    156162        except: 
    157163            self.gui.log.failure(('Screenshot','take_screenshot'), (_('Could not save screenshot'), _('Could not save screenshot %s') % (traceback.format_exc())), 'ERROR') 
     
    164170 
    165171        # Reset the failure flag 
    166         self.currentwindowfailed = False 
     172        self.current_window_failed = False 
    167173 
    168         return self.shotFile 
     174        return self.shot_file 
  • trunk/server.py

    r236 r241  
    2323""" Itaka server engine """ 
    2424 
    25 import datetime, os, traceback, sys 
     25import datetime 
     26import os 
     27import traceback 
     28import sys 
    2629 
    2730try: 
     
    174177    """ 
    175178 
    176     def __init__(self, guiinstance): 
     179    def __init__(self, gui_instance): 
    177180        """ 
    178181        Constructor. Overrides BaseHTTPServer's __init__ to create our resources on-the-fly 
    179182 
    180         @type guiinstance: instance 
    181         @param guiinstance: An instance of our L{Gui} class 
    182         """ 
    183  
    184         self.gui = guiinstance 
    185         self.itakaglobals = self.gui.itakaglobals 
     183        @type gui_instance: instance 
     184        @param gui_instance: An instance of our L{Gui} class 
     185        """ 
     186 
     187        self.gui = gui_instance 
     188        self.itaka_globals = self.gui.itaka_globals 
    186189        self.configuration = self.gui.configuration 
    187190        self.console = self.gui.console 
     
    191194        # Here we use our own static.Data special child resource because we need Authentication handling 
    192195        # Otherwise we would just use our own self.add_static_resource 
    193         self.root = RootResource(self.gui, self.itakaglobals.headhtml + self.configuration['html']['html'] + self.itakaglobals.footerhtml) 
     196        self.root = RootResource(self.gui, self.itaka_globals.head_html + self.configuration['html']['html'] + self.itaka_globals.footer_html) 
    194197        self.add_child_to_resource('root', '', self.root) 
    195198        self.add_child_to_resource('root', 'screenshot', ScreenshotResource(self.gui)) 
     
    203206    """ 
    204207 
    205     def __init__(self, guiinstance, data, type='text/html; charset=UTF-8'): 
     208    def __init__(self, gui_instance, data, type='text/html; charset=UTF-8'): 
    206209 
    207210        """  
    208211        Constructor that inherits code from resource.Resource->static.Data 
    209212 
    210         @type guiinstance: instance 
    211         @param guiinstance: An instance of our L{Gui} class 
     213        @type gui_instance: instance 
     214        @param gui_instance: An instance of our L{Gui} class 
    212215 
    213216        @type html: string 
     
    218221        """ 
    219222 
    220         self.gui = guiinstance 
     223        self.gui = gui_instance 
    221224        self.console = self.gui.console 
    222         self.itakaglobals = self.gui.itakaglobals 
     225        self.itaka_globals = self.gui.itaka_globals 
    223226        self.configuration = self.gui.configuration 
    224227 
     
    228231        self.type = type 
    229232 
    230         self.noauth = self.itakaglobals.headhtml + self.configuration['html']['authfailure'] + self.itakaglobals.footerhtml 
     233        self.noauth = self.itaka_globals.head_html + self.configuration['html']['authfailure'] + self.itaka_globals.footer_html 
    231234 
    232235    def _promptAuth(self): 
     
    288291    """ 
    289292 
    290     def __init__(self, guiinstance): 
     293    def __init__(self, gui_instance): 
    291294        """  
    292295        Constructor 
    293296 
    294         @type guiinstance: instance 
    295         @param guiinstance: An instance of our L{Gui} class 
    296         """ 
    297  
    298         self.gui = guiinstance 
     297        @type gui_instance: instance 
     298        @param gui_instance: An instance of our L{Gui} class 
     299        """ 
     300 
     301        self.gui = gui_instance 
    299302        self.console = self.gui.console 
    300         self.itakaglobals = self.gui.itakaglobals 
     303        self.itaka_globals = self.gui.itaka_globals 
    301304        self.screenshot = screenshot.Screenshot(self.gui) 
    302305         
     
    324327        if (self.request.uri == "/screenshot"): 
    325328            try: 
    326                 self.shotFile = self.screenshot.take_screenshot() 
     329                self.shot_file = self.screenshot.take_screenshot() 
    327330            except error.ItakaScreenshotError: 
    328331                return 
    329332             
    330333            self.request.setHeader('Content-Type', "image/" + self.configuration['screenshot']['format']) 
    331             self.request.setHeader('Content-Length', str(len(self.shotFile))) 
     334            self.request.setHeader('Content-Length', str(len(self.shot_file))) 
    332335            self.request.setHeader('Connection', 'close') 
    333336 
    334337            self.counter += 1 
    335338 
    336             if self.configuration['server']['notify'] and self.itakaglobals.notifyavailable: 
     339            if self.configuration['server']['notify'] and self.itaka_globals.notify_available: 
    337340                import pynotify 
    338                 uri = "file://" + (os.path.join(self.itakaglobals.image_dir, "itaka-take.png"))  
     341                uri = "file://" + (os.path.join(self.itaka_globals.image_dir, "itaka-take.png"))  
    339342 
    340343                n = pynotify.Notification(_('Screenshot taken'), _('%s requested screenshot' % (self.ip)), uri) 
     
    345348            self.gui.update_gui(self.counter, self.ip, self.time) 
    346349 
    347             return open(self.shotFile, 'rb').read() 
     350            return open(self.shot_file, 'rb').read() 
  • trunk/share

    • Property svn:ignore
      •  

        old new  
        11*.pyc 
         2*.pyw 
        23.project 
        34.~ 
  • trunk/share/images

    • Property svn:ignore
      •  

        old new  
        11*.pyc 
         2*.pyw 
        23.project 
        34.~ 
  • trunk/uigtk.py

    r238 r241  
    2323""" Itaka GTK+ GUI """ 
    2424 
    25 import sys, os, datetime, traceback, copy  
     25import sys 
     26import os 
     27import datetime 
     28import traceback 
     29import copy 
    2630 
    2731try: 
     
    6670    """ 
    6771 
    68     def __init__(self, guiinstance, console, configuration): 
     72    def __init__(self, gui_instance, console, configuration): 
    6973        """ 
    7074        Constructor 
    7175 
    72         @type guiinstance: instance 
    73         @param guiinstance: Instance of L{Gui} 
     76        @type gui_instance: instance 
     77        @param gui_instance: Instance of L{Gui} 
    7478 
    7579        @type console: instance 
     
    8084        """ 
    8185 
    82         self.gui = guiinstance 
     86        self.gui = gui_instance 
    8387        self.console = console 
    8488        self.configuration = configuration 
     
    115119        self._write_gui_log(message, None, icon, False) 
    116120 
    117     def detailed_message(self, message, detailedmessage, icon=None): 
     121    def detailed_message(self, message, detailed_message, icon=None): 
    118122        """ 
    119123        Write detailed message on Gui log widgets 
     
    122126        @param message: Message to be inserted in the events log 
    123127 
    124         @type detailedmessage: str 
    125         @param detailedmessage: Message to be inserted in the detailed log 
     128        @type detailed_message: str 
     129        @param detailed_message: Message to be inserted in the detailed log 
    126130 
    127131        @type icon: tuple 
     
    129133        """ 
    130134 
    131         self.console.message(detailedmessage) 
    132         self._write_gui_log(message, detailedmessage, icon, False, False) 
    133  
    134     def failure(self, caller, message, failuretype='ERROR'): 
     135        self.console.message(detailed_message) 
     136        self._write_gui_log(message, detailed_message, icon, False, False) 
     137 
     138    def failure(self, caller, message, failure_type='ERROR'): 
    135139        """ 
    136140        Write failure message on Gui log widgets 
     
    142146        @param message: A tuple containing first the simple message to the events log, and then the detailed message for the detailed log 
    143147 
    144         @type failuretype: str 
    145         @param failuretype: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
    146         """ 
    147          
    148         self.simplemessage = message[0] 
    149         self.detailedmessage = message[1] 
    150  
    151         self.console.failure(caller, self.detailedmessage, failuretype) 
     148        @type failure_type: str 
     149        @param failure_type: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
     150        """ 
     151         
     152        self.simple_message = message[0] 
     153        self.detailed_message = message[1] 
     154 
     155        self.console.failure(caller, self.detailed_message, failure_type) 
    152156 
    153157        # ERRORS require some more actions 
    154         if failuretype == 'ERROR': 
     158        if failure_type == 'ERROR': 
    155159            # Show the window and its widgets, set the status icon blinking timeout 
    156160            if not self.gui.window.get_property("visible"): 
    157161                self.gui.window.present() 
    158                 self.gui.statusicon_blinktimeout() 
     162                self.gui.status_icon_timeout_blink() 
    159163                self.gui.window.move(self.gui.window_position[0], self.gui.window_position[1]) 
    160164 
     
    165169                self.gui.stop_server(None, True) 
    166170 
    167         self._write_gui_log(self.simplemessage, self.detailedmessage, self._get_failure_icon(failuretype), True, True) 
    168  
    169     def _get_failure_icon(self, failuretype): 
     171        self._write_gui_log(self.simple_message, self.detailed_message, self._get_failure_icon(failure_type), True, True) 
     172 
     173    def _get_failure_icon(self, failure_type): 
    170174        """ 
    171175        Return a default stock icon for a failure type 
    172176 
    173         @type failuretype: str 
    174         @param failuretype: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
     177        @type failure_type: str 
     178        @param failure_type: What kind of failure it is, either 'ERROR' (default), 'WARNING' or 'DEBUG' 
    175179 
    176180        @rtype: tuple 
     
    180184        icon = ['stock', 'STOCK_DIALOG_ERROR'] 
    181185         
    182         if failuretype == "WARNING": 
     186        if failure_type == "WARNING": 
    183187            icon = ['stock', 'STOCK_DIALOG_WARNING'] 
    184         elif failuretype == "DEBUG":  
     188        elif failure_type == "DEBUG":  
    185189            icon = ['stock', 'STOCK_DIALOG_INFO'] 
    186190 
    187191        return icon 
    188192 
    189     def _write_gui_log(self, message, detailedmessage=None, icon=None, unpauselogger=True, failure=False): 
     193    def _write_gui_log(self, message, detailed_message=None, icon=None, unpause_logger=True, failure=False): 
    190194        """ 
    191195        Private method to write to both Gui logs 
     
    194198        @param message: Message to be inserted 
    195199 
    196         @type detailedmessage: str 
    197         @param detailedmessage: Optional detailed message if the event log and detailed log messages differ 
     200        @type detailed_message: str 
     201        @param detailed_message: Optional detailed message if the event log and detailed log messages differ 
    198202 
    199203        @type icon: tuple 
    200204        @param icon: The first argument is a string of either 'stock' or 'pixbuf', and the second is a string of gtk.STOCK_ICON or a gtk.gdk.pixbuf object (without the 'gtk.' prefix) 
    201205 
    202         @type unpauselogger: bool 
    203         @param unpauselogger: Whether to unpause the GUI Logger 
     206        @type unpause_logger: bool 
     207        @param unpause_logger: Whether to unpause the GUI Logger 
    204208 
    205209        @type failure: bool 
     
    207211        """ 
    208212 
    209         if detailedmessage is None: 
    210             detailedmessage = message 
     213        if detailed_message is None: 
     214            detailed_message = message 
    211215 
    212216        # Only write messages when the logging is unpaused. Unless we are told otherwise 
    213217        if self.gui.log_paused(): 
    214             if unpauselogger: 
     218            if unpause_logger: 
    215219                self.gui.unpause_log(True) 
    216220                self._write_events_log(message, icon, failure) 
    217                 self._write_detailed_log(detailedmessage) 
     221                self._write_detailed_log(detailed_message) 
    218222        else: 
    219223            self._write_events_log(message, icon, failure) 
    220             self._write_detailed_log(detailedmessage) 
     224            self._write_detailed_log(detailed_message) 
    221225 
    222226    def _write_events_log(self, message, icon=None, failure=False): 
     
    236240        if icon is not None: 
    237241            if icon[0] == "stock": 
    238                 self.inserted_iter = self.gui.logeventsstore.append([self.gui.logeventstreeview.render_icon(stock_id=getattr(gtk, icon[1]), size=gtk.ICON_SIZE_MENU, detail=None), message]) 
     242                self.inserted_iter = self.gui.log_events_store.append([self.gui.log_events_tree_view.render_icon(stock_id=getattr(gtk, icon[1]), size=gtk.ICON_SIZE_MENU, detail=None), message]) 
    239243                # Select the iter if it's a failure 
    240244                if failure: 
    241                     self.selection = self.gui.logeventstreeview.get_selection() 
     245                    self.selection = self.gui.log_events_tree_view.get_selection() 
    242246                    self.selection.select_iter(self.inserted_iter) 
    243247            else: 
    244                 self.inserted_iter = self.gui.logeventsstore.append([icon[1], message]) 
    245         else: 
    246             self.inserted_iter = self.gui.logeventsstore.append([icon, message]) 
     248                self.inserted_iter = self.gui.log_events_store.append([icon[1], message]) 
     249        else: 
     250            self.inserted_iter = self.gui.log_events_store.append([icon, message]) 
    247251 
    248252        # Scroll 
    249         self.gui.logeventstreeview.scroll_to_cell(self.gui.logeventstreeview.get_model().get_path(self.inserted_iter)) 
     253        self.gui.log_events_tree_view.scroll_to_cell(self.gui.log_events_tree_view.get_model().get_path(self.inserted_iter)) 
    250254 
    251255    def _write_detailed_log(self, message, bold=True): 
     
    263267 
    264268        if bold: 
    265             self.gui.logdetailsbuffer.insert_with_tags_by_name(self.gui.logdetailsbuffer.get_end_iter(), message, 'bold-text') 
    266         else: 
    267             self.gui.logdetailsbuffer.insert_at_cursor(message, len(message)) 
     269            self.gui.log_details_buffer.insert_with_tags_by_name(self.gui.log_details_buffer.get_end_iter(), message, 'bold-text') 
     270        else: 
     271            self.gui.log_details_buffer.insert_at_cursor(message, len(message)) 
    268272 
    269273        # Automatically scroll. Use wrap until fix 
    270         self.gui.logdetailstextview.scroll_mark_onscreen(self.gui.logdetailsbuffer.get_insert()) 
     274        self.gui.log_details_text_view.scroll_mark_onscreen(self.gui.log_details_buffer.get_insert()) 
     275 
    271276 
    272277class Gui: 
     
    275280    """ 
    276281 
    277     def __init__(self, consoleinstance, configuration): 
     282    def __init__(self, console_instance, configuration): 
    278283        """ 
    279284        Constructor 
    280285 
    281         @type consoleinstance: instance 
    282         @param consoleinstance: An instance of the L{Console} class 
     286        @type console_instance: instance 
     287        @param console_instance: An instance of the L{Console} class 
    283288 
    284289        @type configuration: tuple 
     
    287292 
    288293        # Load our configuration and console instances and values 
    289         self.console = consoleinstance 
    290         self.itakaglobals = configuration[0] 
     294        self.console = console_instance 
     295        self.itaka_globals = configuration[0] 
    291296 
    292297        # The configuration instance has the user's preferences already loaded 
    293         self.configinstance = configuration[1] 
    294         self.configuration = self.itakaglobals.values 
     298        self.config_instance = configuration[1] 
     299        self.configuration = self.itaka_globals.configuration_values 
    295300 
    296301        # Instances of our Gui Logging class and Screenshot Server 
    297302        self.server = iserver.ScreenshotServer(self) 
    298303        self.log = GuiLog(self, self.console, self.configuration) 
    299         self.logpaused = False 
     304        self.log_is_paused = False 
    300305 
    301306        # Start defining widgets 
    302         self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka.png')) 
     307        self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka.png')) 
    303308        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) 
    304309        self.window.connect('destroy', self.destroy) 
     
    312317 
    313318        # Create our tray icon 
    314         self.statusIcon = gtk.StatusIcon() 
    315         self.statusmenu = gtk.Menu() 
     319        self.status_icon = gtk.StatusIcon() 
     320        self.status_menu = gtk.Menu() 
    316321        if self.configuration['server']['authentication']: 
    317             self.statusIcon.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka-secure.png'))) 
    318         else: 
    319             self.statusIcon.set_from_pixbuf(self.icon_pixbuf) 
    320         self.statusIcon.set_tooltip('Itaka') 
    321         self.statusIcon.set_visible(True) 
    322         self.statusIcon.connect('activate', self.statusicon_activate) 
    323         self.statusIcon.connect('popup-menu', self.statusicon_menu, self.statusmenu) 
    324  
    325         self.startimage = gtk.Image() 
    326         self.startimage.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU) 
    327  
    328         self.stopimage = gtk.Image() 
    329         self.stopimage.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU) 
    330         self.menuitemstart = gtk.ImageMenuItem(_('St_art'))  
    331         self.menuitemstart.set_image(self.startimage) 
    332         self.menuitemstart.connect('activate', self.start_server, True) 
    333         self.menuitemstop = gtk.ImageMenuItem(_('St_op'))  
    334         self.menuitemstop.set_image(self.stopimage) 
    335         self.menuitemstop.connect('activate', self.stop_server, True) 
    336         self.menuitemstop.set_sensitive(False) 
    337  
    338         if self.itakaglobals.notifyavailable:  
    339             self.menuitemnotifications = gtk.CheckMenuItem(_('Show _Notifications')) 
     322            self.status_icon.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka-secure.png'))) 
     323        else: 
     324            self.status_icon.set_from_pixbuf(self.icon_pixbuf) 
     325        self.status_icon.set_tooltip('Itaka') 
     326        self.status_icon.set_visible(True) 
     327        self.status_icon.connect('activate', self.status_icon_activate) 
     328        self.status_icon.connect('popup-menu', self.status_icon_menu, self.status_menu) 
     329 
     330        self.start_image = gtk.Image() 
     331        self.start_image.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU) 
     332 
     333        self.stop_image = gtk.Image() 
     334        self.stop_image.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU) 
     335        self.menu_item_start = gtk.ImageMenuItem(_('St_art'))  
     336        self.menu_item_start.set_image(self.start_image) 
     337        self.menu_item_start.connect('activate', self.start_server, True) 
     338        self.menu_item_stop = gtk.ImageMenuItem(_('St_op'))  
     339        self.menu_item_stop.set_image(self.stop_image) 
     340        self.menu_item_stop.connect('activate', self.stop_server, True) 
     341        self.menu_item_stop.set_sensitive(False) 
     342 
     343        if self.itaka_globals.notify_available:  
     344            self.menu_item_notifications = gtk.CheckMenuItem(_('Show _Notifications')) 
    340345            if self.configuration['server']['notify']: 
    341                 self.menuitemnotifications.set_active(True) 
    342             self.menuitemnotifications.connect('toggled', self.statusicon_notify) 
    343  
    344         self.menuitemseparator = gtk.SeparatorMenuItem() 
    345         self.menuitemseparator1 = gtk.SeparatorMenuItem() 
    346         self.menuitemquit = gtk.ImageMenuItem(gtk.STOCK_QUIT) 
    347         self.menuitemquit.connect('activate', self.destroy) 
    348  
    349         self.statusmenu.append(self.menuitemstart) 
    350         self.statusmenu.append(self.menuitemstop) 
    351         if self.itakaglobals.notifyavailable:  
    352             self.statusmenu.append(self.menuitemseparator) 
    353             self.statusmenu.append(self.menuitemnotifications) 
    354         self.statusmenu.append(self.menuitemseparator1) 
    355         self.statusmenu.append(self.menuitemquit) 
     346                self.menu_item_notifications.set_active(True) 
     347            self.menu_item_notifications.connect('toggled', self.status_icon_notify) 
     348 
     349        self.menu_item_separator = gtk.SeparatorMenuItem() 
     350        self.menu_item_separator1 = gtk.SeparatorMenuItem() 
     351        self.menu_item_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT) 
     352        self.menu_item_quit.connect('activate', self.destroy) 
     353 
     354        self.status_menu.append(self.menu_item_start) 
     355        self.status_menu.append(self.menu_item_stop) 
     356        if self.itaka_globals.notify_available:  
     357            self.status_menu.append(self.menu_item_separator) 
     358            self.status_menu.append(self.menu_item_notifications) 
     359        self.status_menu.append(self.menu_item_separator1) 
     360        self.status_menu.append(self.menu_item_quit) 
    356361 
    357362        self.vbox = gtk.VBox(False, 6) 
    358363        self.box = gtk.HBox(False, 0) 
    359364 
    360         self.itakaLogo = gtk.Image() 
     365        self.itaka_logo = gtk.Image() 
    361366        if self.configuration['server']['authentication']: 
    362             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka-secure.png')) 
    363         else: 
    364             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka.png')) 
    365         self.itakaLogo.show() 
    366  
    367         self.box.pack_start(self.itakaLogo, False, False, 35) 
    368  
    369         self.buttonStartstop = gtk.ToggleButton(_('Start'), gtk.STOCK_PREFERENCES) 
    370         self.startstopimage = gtk.Image() 
    371  
    372         self.startstopimage.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON) 
    373         self.buttonStartstop.set_image(self.startstopimage) 
    374         self.buttonStartstop.connect('toggled', self.button_start_server) 
    375  
    376         self.preferencesButton = gtk.Button('Preferences', gtk.STOCK_PREFERENCES) 
    377         self.preferencesButton.connect('clicked', self.expandpreferences) 
     367            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka-secure.png')) 
     368        else: 
     369            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka.png')) 
     370        self.itaka_logo.show() 
     371 
     372        self.box.pack_start(self.itaka_logo, False, False, 35) 
     373 
     374        self.button_start_stop = gtk.ToggleButton(_('Start'), gtk.STOCK_PREFERENCES) 
     375        self.start_stop_image = gtk.Image() 
     376 
     377        self.start_stop_image.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON) 
     378        self.button_start_stop.set_image(self.start_stop_image) 
     379        self.button_start_stop.connect('toggled', self.button_start_server) 
     380 
     381        self.button_preferences = gtk.Button('Preferences', gtk.STOCK_PREFERENCES) 
     382        self.button_preferences.connect('clicked', self.expandpreferences) 
    378383 
    379384        # Set up some variables for our timeouts/animations 
    380         self.preferenceshidden = False 
    381         self.preferencesexpanded = False 
    382         self.contracttimeout = None 
    383         self.expandtimeout = None 
    384         self.blinktimeout = None 
    385  
    386         self.box.pack_start(self.buttonStartstop, True, True, 5) 
    387         self.box.pack_start(self.preferencesButton, True, True, 8) 
     385        self.preferences_hidden = False 
     386        self.preferences_expanded = False 
     387        self.timeout_contract = None 
     388        self.timeout_expand = None 
     389        self.timeout_blink = None 
     390 
     391        self.box.pack_start(self.button_start_stop, True, True, 5) 
     392        self.box.pack_start(self.button_preferences, True, True, 8) 
    388393 
    389394        self.vbox.pack_start(self.box, False, False, 0) 
    390395 
    391         self.statusBox = gtk.HBox(False, 0) 
    392         self.labelServed = gtk.Label() 
    393         self.labelLastip = gtk.Label() 
    394         self.labelTime = gtk.Label() 
    395  
    396         self.statusBox.pack_start(self.labelLastip, True, False, 0) 
    397         self.statusBox.pack_start(self.labelTime, True, False, 0) 
    398         self.statusBox.pack_start(self.labelServed, True, False, 0) 
     396        self.hbox_status = gtk.HBox(False, 0) 
     397        self.label_served = gtk.Label() 
     398        self.label_last_ip = gtk.Label() 
     399        self.label_time = gtk.Label() 
     400 
     401        self.hbox_status.pack_start(self.label_last_ip, True, False, 0) 
     402        self.hbox_status.pack_start(self.label_time, True, False, 0) 
     403        self.hbox_status.pack_start(self.label_served, True, False, 0) 
    399404 
    400405        # Logger widget (displayed when expanded) 
    401         self.logvbox = gtk.VBox(False, 0) 
    402         self.lognotebook = gtk.Notebook() 
    403         self.lognotebook.set_tab_pos(gtk.POS_BOTTOM) 
    404  
    405         self.logeventslabel = gtk.Label(_('Events')) 
    406         self.logdetailslabel = gtk.Label(_('Details')) 
    407  
    408         self.logeventsscroll = gtk.ScrolledWindow() 
    409         self.logeventsscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 
    410         self.logeventsscroll.set_shadow_type(gtk.SHADOW_NONE) 
    411  
    412         self.logeventsstore = gtk.ListStore(gtk.gdk.Pixbuf, str) 
    413         self.logeventstreeview = gtk.TreeView(self.logeventsstore) 
    414         self.logeventstreeview.set_property('headers-visible', False) 
    415         self.logeventstreeview.set_property('rules-hint', True) 
    416  
    417         self.logeventscolumnicon = gtk.TreeViewColumn() 
    418         self.logeventscolumntext = gtk.TreeViewColumn() 
    419         self.logeventstreeview.append_column(self.logeventscolumnicon) 
    420         self.logeventstreeview.append_column(self.logeventscolumntext) 
    421  
    422         self.logeventscellpixbuf = gtk.CellRendererPixbuf() 
    423         self.logeventscolumnicon.pack_start(self.logeventscellpixbuf) 
    424         self.logeventscolumnicon.add_attribute(self.logeventscellpixbuf, 'pixbuf', 0) 
    425  
    426         self.logeventscelltext = gtk.CellRendererText() 
    427         self.logeventscolumntext.pack_start(self.logeventscelltext, True) 
    428         self.logeventscolumntext.add_attribute(self.logeventscelltext, 'text', 1) 
    429         self.logeventsscroll.add(self.logeventstreeview) 
    430  
    431         self.logdetailsscroll = gtk.ScrolledWindow() 
    432         self.logdetailsscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 
    433         self.logdetailsscroll.set_shadow_type(gtk.SHADOW_NONE) 
    434         self.logdetailstextview = gtk.TextView() 
    435         self.logdetailstextview.set_wrap_mode(gtk.WRAP_WORD) 
    436         self.logdetailstextview.set_editable(False) 
    437         self.logdetailstextview.set_size_request(-1, 160) 
    438         self.logdetailsbuffer = self.logdetailstextview.get_buffer() 
    439         self.logdetailsbuffer.create_tag ('bold-text', weight = pango.WEIGHT_BOLD) 
    440         self.logdetailsscroll.add(self.logdetailstextview) 
    441  
    442         self.lognotebook.append_page(self.logeventsscroll, self.logeventslabel) 
    443         self.lognotebook.append_page(self.logdetailsscroll, self.logdetailslabel) 
    444  
    445         self.loghbox = gtk.HBox(False, 0) 
    446         self.logclearbutton = gtk.Button(_('Clear')) 
    447         self.logclearbuttonimage = gtk.Image() 
    448         self.logclearbuttonimage.set_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON) 
    449         self.logclearbutton.set_image(self.logclearbuttonimage) 
    450         self.logclearbutton.connect('clicked', self.clearlogger) 
    451  
    452         self.logpausebutton = gtk.ToggleButton(_('Pause')) 
    453         self.logpausebuttonimage = gtk.Image() 
    454         self.logpausebuttonimage.set_from_stock(gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_BUTTON) 
    455         self.logpausebutton.set_image(self.logpausebuttonimage) 
    456         self.logpausebutton.connect('toggled', self.button_pause_log) 
    457  
    458         self.loghbox.pack_end(self.logclearbutton, False, False, 4) 
    459         self.loghbox.pack_end(self.logpausebutton, False, False, 4) 
    460  
    461         self.logvbox.pack_start(self.lognotebook, False, False, 4) 
    462         self.logvbox.pack_start(self.loghbox, False, False, 4) 
    463  
    464         self.logboxLabel = gtk.Label(_('<b>Server log</b>')) 
    465         self.logboxLabel.set_use_markup(True) 
     406        self.vbox_log = gtk.VBox(False, 0) 
     407        self.notebook_log = gtk.Notebook() 
     408        self.notebook_log.set_tab_pos(gtk.POS_BOTTOM) 
     409 
     410        self.label_log_events = gtk.Label(_('Events')) 
     411        self.label_log_details = gtk.Label(_('Details')) 
     412 
     413        self.scroll_log_events = gtk.ScrolledWindow() 
     414        self.scroll_log_events.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 
     415        self.scroll_log_events.set_shadow_type(gtk.SHADOW_NONE) 
     416 
     417        self.log_events_store = gtk.ListStore(gtk.gdk.Pixbuf, str) 
     418        self.log_events_tree_view = gtk.TreeView(self.log_events_store) 
     419        self.log_events_tree_view.set_property('headers-visible', False) 
     420        self.log_events_tree_view.set_property('rules-hint', True) 
     421 
     422        self.column_log_events_icon = gtk.TreeViewColumn() 
     423        self.column_log_events = gtk.TreeViewColumn() 
     424        self.log_events_tree_view.append_column(self.column_log_events_icon) 
     425        self.log_events_tree_view.append_column(self.column_log_events) 
     426 
     427        self.cell_pixbuf_log_events = gtk.CellRendererPixbuf() 
     428        self.column_log_events_icon.pack_start(self.cell_pixbuf_log_events) 
     429        self.column_log_events_icon.add_attribute(self.cell_pixbuf_log_events, 'pixbuf', 0) 
     430 
     431        self.cell_text_log_events = gtk.CellRendererText() 
     432        self.column_log_events.pack_start(self.cell_text_log_events, True) 
     433        self.column_log_events.add_attribute(self.cell_text_log_events, 'text', 1) 
     434        self.scroll_log_events.add(self.log_events_tree_view) 
     435 
     436        self.scroll_log_details = gtk.ScrolledWindow() 
     437        self.scroll_log_details.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 
     438        self.scroll_log_details.set_shadow_type(gtk.SHADOW_NONE) 
     439        self.log_details_text_view = gtk.TextView() 
     440        self.log_details_text_view.set_wrap_mode(gtk.WRAP_WORD) 
     441        self.log_details_text_view.set_editable(False) 
     442        self.log_details_text_view.set_size_request(-1, 160) 
     443        self.log_details_buffer = self.log_details_text_view.get_buffer() 
     444        self.log_details_buffer.create_tag ('bold-text', weight = pango.WEIGHT_BOLD) 
     445        self.scroll_log_details.add(self.log_details_text_view) 
     446 
     447        self.notebook_log.append_page(self.scroll_log_events, self.label_log_events) 
     448        self.notebook_log.append_page(self.scroll_log_details, self.label_log_details) 
     449 
     450        self.hbox_log = gtk.HBox(False, 0) 
     451        self.button_log_clear = gtk.Button(_('Clear')) 
     452        self.button_log_clearimage = gtk.Image() 
     453        self.button_log_clearimage.set_from_stock(gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON) 
     454        self.button_log_clear.set_image(self.button_log_clearimage) 
     455        self.button_log_clear.connect('clicked', self.clearlogger) 
     456 
     457        self.button_log_pause = gtk.ToggleButton(_('Pause')) 
     458        self.button_log_pauseimage = gtk.Image() 
     459        self.button_log_pauseimage.set_from_stock(gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_BUTTON) 
     460        self.button_log_pause.set_image(self.button_log_pauseimage) 
     461        self.button_log_pause.connect('toggled', self.button_pause_log) 
     462 
     463        self.hbox_log.pack_end(self.button_log_clear, False, False, 4) 
     464        self.hbox_log.pack_end(self.button_log_pause, False, False, 4) 
     465 
     466        self.vbox_log.pack_start(self.notebook_log, False, False, 4) 
     467        self.vbox_log.pack_start(self.hbox_log, False, False, 4) 
     468 
     469        self.label_log_box = gtk.Label(_('<b>Server log</b>')) 
     470        self.label_log_box.set_use_markup(True) 
    466471 
    467472        self.expander_size_finalized = False 
    468473        self.expander = gtk.Expander(None) 
    469         self.expander.set_label_widget(self.logboxLabel) 
     474        self.expander.set_label_widget(self.label_log_box) 
    470475        self.expander.connect('notify::expanded', self.expandlogger) 
    471476 
    472         self.vbox.pack_start(self.statusBox, False, False, 4) 
     477        self.vbox.pack_start(self.hbox_status, False, False, 4) 
    473478        self.vbox.pack_start(self.expander, False, False, 0) 
    474479        self.expander.set_sensitive(False) 
    475480 
    476481        # This is are the preference widgets that are going to be added and shown later 
    477         self.preferencesVBox = gtk.VBox(False, 7) 
    478         self.preferencesVBoxitems = gtk.VBox(False, 5) 
    479         self.preferencesVBoxitems.set_border_width(2) 
     482        self.vbox_preferences = gtk.VBox(False, 7) 
     483        self.vbox_preferences_items = gtk.VBox(False, 5) 
     484        self.vbox_preferences_items.set_border_width(2) 
    480485         
    481486        # Create our Hboxes 
    482487        for n in xrange(1, 10+1): 
    483             setattr(self, 'preferencesHBox%d' % (n), gtk.HBox(False, 0)) 
    484  
    485         self.preferencesFramesettings = gtk.Frame() 
    486         self.preferencesSettingslabel = gtk.Label(_('<b>Preferences</b>')) 
    487         self.preferencesSettingslabel.set_use_markup(True) 
    488         self.preferencesFramesettings.set_label_widget(self.preferencesSettingslabel) 
    489         self.preferencesFramesettings.set_label_align(0.5, 0.5) 
    490  
    491         self.preferencesLabelport = gtk.Label(_('Port')) 
    492         self.preferencesLabelport.set_justify(gtk.JUSTIFY_LEFT) 
    493         self.preferencesLabelport.set_alignment(0, 0.60) 
    494  
    495         self.preferencesLabelauth = gtk.Label(_('Authentication')) 
    496         self.preferencesLabelauth.set_justify(gtk.JUSTIFY_LEFT) 
    497         self.preferencesLabelauth.set_alignment(0, 0.60) 
    498  
    499         self.preferencesLabeluser = gtk.Label(_('Username')) 
    500         self.preferencesLabeluser.set_justify(gtk.JUSTIFY_LEFT) 
    501         self.preferencesLabeluser.set_alignment(0, 0.60) 
    502  
    503         self.preferencesLabelpass = gtk.Label(_('Password')) 
    504         self.preferencesLabelpass.set_justify(gtk.JUSTIFY_LEFT) 
    505         self.preferencesLabelpass.set_alignment(0, 0.60) 
    506  
    507         self.preferencesLabelformat = gtk.Label(_('Format')) 
    508         self.preferencesLabelformat.set_justify(gtk.JUSTIFY_LEFT) 
    509         self.preferencesLabelformat.set_alignment(0, 0.50) 
    510  
    511         self.preferencesLabelquality = gtk.Label(_('Quality')) 
    512         self.preferencesLabelquality.set_justify(gtk.JUSTIFY_LEFT) 
    513         self.preferencesLabelquality.set_alignment(0, 0.50) 
    514  
    515         self.preferencesLabelscale = gtk.Label(_('Scale')) 
    516         self.preferencesLabelscale.set_justify(gtk.JUSTIFY_LEFT) 
    517         self.preferencesLabelscale.set_alignment(0, 0.50) 
    518  
    519         if not self.itakaglobals.system == 'nt': 
    520             self.preferencesLabelscreenshot = gtk.Label(_('Window')) 
    521             self.preferencesLabelscreenshot.set_justify(gtk.JUSTIFY_LEFT) 
    522             self.preferencesLabelscreenshot.set_alignment(0, 0.50) 
    523  
    524         if self.itakaglobals.notifyavailable:  
    525             self.preferencesLabelnotifications = gtk.Label(_('Notifications')) 
    526             self.preferencesLabelnotifications.set_justify(gtk.JUSTIFY_LEFT) 
    527             self.preferencesLabelnotifications.set_alignment(0, 0.50) 
    528  
    529         self.adjustmentport = gtk.Adjustment(float(self.configuration['server']['port']), 1024, 65535, 1, 0, 0) 
    530         self.preferencesSpinport = gtk.SpinButton(self.adjustmentport) 
    531         self.preferencesSpinport.set_numeric(True) 
    532  
    533         self.preferencesEntryuser = gtk.Entry() 
    534         self.preferencesEntryuser.set_width_chars(11) 
    535         self.preferencesEntryuser.set_text(self.configuration['server']['username']) 
    536  
    537         self.preferencesEntrypass = gtk.Entry() 
    538         self.preferencesEntrypass.set_width_chars(11) 
    539         if self.itakaglobals.system == 'nt': 
     488            setattr(self, 'hbox_preferences_%d' % (n), gtk.HBox(False, 0)) 
     489 
     490        self.frame_preference_settings = gtk.Frame() 
     491        self.label_preferences_settings = gtk.Label(_('<b>Preferences</b>')) 
     492        self.label_preferences_settings.set_use_markup(True) 
     493        self.frame_preference_settings.set_label_widget(self.label_preferences_settings) 
     494        self.frame_preference_settings.set_label_align(0.5, 0.5) 
     495 
     496        self.label_preferences_port = gtk.Label(_('Port')) 
     497        self.label_preferences_port.set_justify(gtk.JUSTIFY_LEFT) 
     498        self.label_preferences_port.set_alignment(0, 0.60) 
     499 
     500        self.label_preferences_auth = gtk.Label(_('Authentication')) 
     501        self.label_preferences_auth.set_justify(gtk.JUSTIFY_LEFT) 
     502        self.label_preferences_auth.set_alignment(0, 0.60) 
     503 
     504        self.label_preferences_user = gtk.Label(_('Username')) 
     505        self.label_preferences_user.set_justify(gtk.JUSTIFY_LEFT) 
     506        self.label_preferences_user.set_alignment(0, 0.60) 
     507 
     508        self.label_preferences_pass = gtk.Label(_('Password')) 
     509        self.label_preferences_pass.set_justify(gtk.JUSTIFY_LEFT) 
     510        self.label_preferences_pass.set_alignment(0, 0.60) 
     511 
     512        self.label_preferences_format = gtk.Label(_('Format')) 
     513        self.label_preferences_format.set_justify(gtk.JUSTIFY_LEFT) 
     514        self.label_preferences_format.set_alignment(0, 0.50) 
     515 
     516        self.label_preferences_quality = gtk.Label(_('Quality')) 
     517        self.label_preferences_quality.set_justify(gtk.JUSTIFY_LEFT) 
     518        self.label_preferences_quality.set_alignment(0, 0.50) 
     519 
     520        self.label_preferences_scale = gtk.Label(_('Scale')) 
     521        self.label_preferences_scale.set_justify(gtk.JUSTIFY_LEFT) 
     522        self.label_preferences_scale.set_alignment(0, 0.50) 
     523 
     524        if not self.itaka_globals.system == 'nt': 
     525            self.label_preferences_screenshot = gtk.Label(_('Window')) 
     526            self.label_preferences_screenshot.set_justify(gtk.JUSTIFY_LEFT) 
     527            self.label_preferences_screenshot.set_alignment(0, 0.50) 
     528 
     529        if self.itaka_globals.notify_available:  
     530            self.label_preferences_notifications = gtk.Label(_('Notifications')) 
     531            self.label_preferences_notifications.set_justify(gtk.JUSTIFY_LEFT) 
     532            self.label_preferences_notifications.set_alignment(0, 0.50) 
     533 
     534        self.adjustment_preferences_port = gtk.Adjustment(float(self.configuration['server']['port']), 1024, 65535, 1, 0, 0) 
     535        self.spin_preferences_port = gtk.SpinButton(self.adjustment_preferences_port) 
     536        self.spin_preferences_port.set_numeric(True) 
     537 
     538        self.entry_preferences_user = gtk.Entry() 
     539        self.entry_preferences_user.set_width_chars(11) 
     540        self.entry_preferences_user.set_text(self.configuration['server']['username']) 
     541 
     542        self.entry_preferences_pass = gtk.Entry() 
     543        self.entry_preferences_pass.set_width_chars(11) 
     544        if self.itaka_globals.system == 'nt': 
    540545            char = '*' 
    541546        else: 
    542547            char = u'\u25cf' 
    543548 
    544         self.preferencesEntrypass.set_invisible_char(char) 
    545         self.preferencesEntrypass.set_visibility(False) 
    546         self.preferencesEntrypass.set_text(self.configuration['server']['password']) 
    547  
    548         self.preferencesCheckauth = gtk.CheckButton() 
    549         self.preferencesCheckauth.connect('toggled', self._preferences_authentication_toggled) 
     549        self.entry_preferences_pass.set_invisible_char(char) 
     550        self.entry_preferences_pass.set_visibility(False) 
     551        self.entry_preferences_pass.set_text(self.configuration['server']['password']) 
     552 
     553        self.check_preferences_auth = gtk.CheckButton() 
     554        self.check_preferences_auth.connect('toggled', self._preferences_authentication_toggled) 
    550555        if self.configuration['server']['authentication']: 
    551             self.preferencesCheckauth.set_active(1) 
     556            self.check_preferences_auth.set_active(1) 
    552557        else:  
    553             self.preferencesCheckauth.set_active(0) 
     558            self.check_preferences_auth.set_active(0) 
    554559 
    555560        if not self.configuration['server']['authentication']: 
    556             self.preferencesEntryuser.set_sensitive(False) 
    557             self.preferencesEntrypass.set_sensitive(False) 
    558  
    559         self.adjustmentquality = gtk.Adjustment(float(self.configuration['screenshot']['quality']), 0, 100, 1, 0, 0) 
    560         self.preferencesSpinquality = gtk.SpinButton(self.adjustmentquality) 
    561         self.preferencesSpinquality.set_numeric(True) 
    562  
    563         self.adjustmentscale = gtk.Adjustment(float(self.configuration['screenshot']['scalepercent']), 1, 100, 1, 0, 0) 
    564         self.preferencesSpinscale = gtk.SpinButton(self.adjustmentscale) 
    565         self.preferencesSpinscale.set_numeric(True) 
    566  
    567         self.preferencesComboformat = gtk.combo_box_new_text() 
    568         self.preferencesComboformat.connect('changed', self._preferences_combo_changed) 
    569         self.preferencesComboformat.append_text('JPG') 
    570         self.preferencesComboformat.append_text('PNG') 
     561            self.entry_preferences_user.set_sensitive(False) 
     562            self.entry_preferences_pass.set_sensitive(False) 
     563 
     564        self.adjustment_preferences_quality = gtk.Adjustment(float(self.configuration['screenshot']['quality']), 0, 100, 1, 0, 0) 
     565        self.spin_preferences_quality = gtk.SpinButton(self.adjustment_preferences_quality) 
     566        self.spin_preferences_quality.set_numeric(True) 
     567 
     568        self.adjustment_preferences_scale = gtk.Adjustment(float(self.configuration['screenshot']['scalepercent']), 1, 100, 1, 0, 0) 
     569        self.spin_preferences_scale = gtk.SpinButton(self.adjustment_preferences_scale) 
     570        self.spin_preferences_scale.set_numeric(True) 
     571 
     572        self.combo_preferences_format = gtk.combo_box_new_text() 
     573        self.combo_preferences_format.connect('changed', self._preferences_combo_changed) 
     574        self.combo_preferences_format.append_text('JPG') 
     575        self.combo_preferences_format.append_text('PNG') 
    571576        if self.configuration['screenshot']['format'] == 'jpeg': 
    572             self.preferencesComboformat.set_active(0) 
     577            self.combo_preferences_format.set_active(0) 
    573578        else:  
    574             self.preferencesComboformat.set_active(1) 
    575             self.preferencesHBox6.set_sensitive(False) 
    576  
    577         if self.itakaglobals.notifyavailable:  
    578             self.preferencesChecknotifications = gtk.CheckButton() 
     579            self.combo_preferences_format.set_active(1) 
     580            self.hbox_preferences_6.set_sensitive(False) 
     581 
     582        if self.itaka_globals.notify_available:  
     583            self.check_preferences_notifications = gtk.CheckButton() 
    579584            if self.configuration['server']['notify']: 
    580                 self.preferencesChecknotifications.set_active(1) 
     585                self.check_preferences_notifications.set_active(1) 
    581586            else:  
    582                 self.preferencesChecknotifications.set_active(0) 
    583  
    584         if not self.itakaglobals.system == 'nt': 
    585             self.preferencesComboscreenshot = gtk.combo_box_new_text() 
    586             self.preferencesComboscreenshot.append_text(_('Fullscreen')) 
    587             self.preferencesComboscreenshot.append_text(_('Active window')) 
     587                self.check_preferences_notifications.set_active(0) 
     588 
     589        if not self.itaka_globals.system == 'nt': 
     590            self.combo_preferences_screenshot = gtk.combo_box_new_text() 
     591            self.combo_preferences_screenshot.append_text(_('Fullscreen')) 
     592            self.combo_preferences_screenshot.append_text(_('Active window')) 
    588593            if self.configuration['screenshot']['currentwindow']: 
    589                 self.preferencesComboscreenshot.set_active(1) 
     594                self.combo_preferences_screenshot.set_active(1) 
    590595            else:  
    591                 self.preferencesComboscreenshot.set_active(0) 
    592  
    593         self.preferencesButtonClose = gtk.Button('Close', gtk.STOCK_CLOSE) 
    594         self.preferencesButtonClose.connect('clicked', lambda wid: self.contractpreferences()) 
    595          
    596         self.preferencesButtonAbout = gtk.Button('About', gtk.STOCK_ABOUT) 
    597         self.preferencesButtonAbout.connect('clicked', lambda wid: self.about()) 
    598  
    599         self.preferencesHBox1.pack_start(self.preferencesLabelport, False, False, 12) 
    600         self.preferencesHBox1.pack_end(self.preferencesSpinport, False, False, 7) 
    601         self.preferencesHBox2.pack_start(self.preferencesLabelauth, False, False, 12) 
    602         self.preferencesHBox3.pack_start(self.preferencesLabeluser, False, False, 12) 
    603         self.preferencesHBox4.pack_end(self.preferencesEntrypass, False, False, 7) 
    604         self.preferencesHBox4.pack_start(self.preferencesLabelpass, False, False, 12) 
    605         self.preferencesHBox3.pack_end(self.preferencesEntryuser, False, False, 7) 
    606         self.preferencesHBox2.pack_end(self.preferencesCheckauth, False, False, 7) 
    607         self.preferencesHBox5.pack_start(self.preferencesLabelformat, False, False, 12) 
    608         self.preferencesHBox5.pack_end(self.preferencesComboformat, False, False, 7) 
    609         self.preferencesHBox6.pack_start(self.preferencesLabelquality, False, False, 12) 
    610         self.preferencesHBox6.pack_end(self.preferencesSpinquality, False, False, 7) 
    611         if not self.itakaglobals.system == 'nt': 
    612             self.preferencesHBox7.pack_start(self.preferencesLabelscreenshot, False, False, 12) 
    613             self.preferencesHBox7.pack_end(self.preferencesComboscreenshot, False, False, 7) 
    614         self.preferencesHBox8.pack_start(self.preferencesLabelscale, False, False, 12) 
    615         self.preferencesHBox8.pack_end(self.preferencesSpinscale, False, False, 7) 
    616         if self.itakaglobals.notifyavailable:  
    617             self.preferencesHBox9.pack_start(self.preferencesLabelnotifications, False, False, 12) 
    618             self.preferencesHBox9.pack_end(self.preferencesChecknotifications, False, False, 7) 
    619         self.preferencesHBox10.pack_start(self.preferencesButtonAbout, False, False, 7) 
    620         self.preferencesHBox10.pack_end(self.preferencesButtonClose, False, False, 7) 
    621  
    622         self.preferencesVBoxitems.pack_start(self.preferencesHBox1, False, False, 0) 
    623         self.preferencesVBoxitems.pack_start(self.preferencesHBox2, False, False, 0) 
    624         self.preferencesVBoxitems.pack_start(self.preferencesHBox3, False, False, 0) 
    625         self.preferencesVBoxitems.pack_start(self.preferencesHBox4, False, False, 0) 
    626         self.preferencesVBoxitems.pack_start(self.preferencesHBox5, False, False, 0) 
    627         self.preferencesVBoxitems.pack_start(self.preferencesHBox6, False, False, 0) 
    628         if not self.itakaglobals.system == 'nt': 
    629             self.preferencesVBoxitems.pack_start(self.preferencesHBox7, False, False, 0) 
    630         self.preferencesVBoxitems.pack_start(self.preferencesHBox8, False, False, 0) 
    631         if self.itakaglobals.notifyavailable:  
    632             self.preferencesVBoxitems.pack_start(self.preferencesHBox9, False, False, 0) 
    633  
    634         self.preferencesFramesettings.add(self.preferencesVBoxitems) 
    635         self.preferencesVBox.pack_start(self.preferencesFramesettings, False, False, 0) 
    636         self.preferencesVBox.pack_start(self.preferencesHBox10, False, False, 4) 
     596                self.combo_preferences_screenshot.set_active(0) 
     597 
     598        self.button_preferences_close = gtk.Button('Close', gtk.STOCK_CLOSE) 
     599        self.button_preferences_close.connect('clicked', lambda wid: self.contractpreferences()) 
     600         
     601        self.button_preferences_about = gtk.Button('About', gtk.STOCK_ABOUT) 
     602        self.button_preferences_about.connect('clicked', lambda wid: self.about()) 
     603 
     604        self.hbox_preferences_1.pack_start(self.label_preferences_port, False, False, 12) 
     605        self.hbox_preferences_1.pack_end(self.spin_preferences_port, False, False, 7) 
     606        self.hbox_preferences_2.pack_start(self.label_preferences_auth, False, False, 12) 
     607        self.hbox_preferences_3.pack_start(self.label_preferences_user, False, False, 12) 
     608        self.hbox_preferences_4.pack_end(self.entry_preferences_pass, False, False, 7) 
     609        self.hbox_preferences_4.pack_start(self.label_preferences_pass, False, False, 12) 
     610        self.hbox_preferences_3.pack_end(self.entry_preferences_user, False, False, 7) 
     611        self.hbox_preferences_2.pack_end(self.check_preferences_auth, False, False, 7) 
     612        self.hbox_preferences_5.pack_start(self.label_preferences_format, False, False, 12) 
     613        self.hbox_preferences_5.pack_end(self.combo_preferences_format, False, False, 7) 
     614        self.hbox_preferences_6.pack_start(self.label_preferences_quality, False, False, 12) 
     615        self.hbox_preferences_6.pack_end(self.spin_preferences_quality, False, False, 7) 
     616        if not self.itaka_globals.system == 'nt': 
     617            self.hbox_preferences_7.pack_start(self.label_preferences_screenshot, False, False, 12) 
     618            self.hbox_preferences_7.pack_end(self.combo_preferences_screenshot, False, False, 7) 
     619        self.hbox_preferences_8.pack_start(self.label_preferences_scale, False, False, 12) 
     620        self.hbox_preferences_8.pack_end(self.spin_preferences_scale, False, False, 7) 
     621        if self.itaka_globals.notify_available:  
     622            self.hbox_preferences_9.pack_start(self.label_preferences_notifications, False, False, 12) 
     623            self.hbox_preferences_9.pack_end(self.check_preferences_notifications, False, False, 7) 
     624        self.hbox_preferences_10.pack_start(self.button_preferences_about, False, False, 7) 
     625        self.hbox_preferences_10.pack_end(self.button_preferences_close, False, False, 7) 
     626 
     627        self.vbox_preferences_items.pack_start(self.hbox_preferences_1, False, False, 0) 
     628        self.vbox_preferences_items.pack_start(self.hbox_preferences_2, False, False, 0) 
     629        self.vbox_preferences_items.pack_start(self.hbox_preferences_3, False, False, 0) 
     630        self.vbox_preferences_items.pack_start(self.hbox_preferences_4, False, False, 0) 
     631        self.vbox_preferences_items.pack_start(self.hbox_preferences_5, False, False, 0) 
     632        self.vbox_preferences_items.pack_start(self.hbox_preferences_6, False, False, 0) 
     633        if not self.itaka_globals.system == 'nt': 
     634            self.vbox_preferences_items.pack_start(self.hbox_preferences_7, False, False, 0) 
     635        self.vbox_preferences_items.pack_start(self.hbox_preferences_8, False, False, 0) 
     636        if self.itaka_globals.notify_available:  
     637            self.vbox_preferences_items.pack_start(self.hbox_preferences_9, False, False, 0) 
     638 
     639        self.frame_preference_settings.add(self.vbox_preferences_items) 
     640        self.vbox_preferences.pack_start(self.frame_preference_settings, False, False, 0) 
     641        self.vbox_preferences.pack_start(self.hbox_preferences_10, False, False, 4) 
    637642 
    638643        self.window.add(self.vbox) 
     
    648653         
    649654        # So we can mess with the values in the running one and not mess up our comparison 
    650         self.currentconfiguration = copy.deepcopy(self.configuration) 
     655        self.current_configuration = copy.deepcopy(self.configuration) 
    651656 
    652657        # Switch to the proper values 
    653         formatvalue = str(self.preferencesComboformat.get_active_text()) 
    654         if formatvalue == 'PNG': 
    655             formatvalue = 'png' 
     658        self.format_value = str(self.combo_preferences_format.get_active_text()) 
     659        if self.format_value == 'PNG': 
     660            self.format_value = 'png' 
    656661            self.configuration['screenshot']['format'] = 'png' 
    657662        else: 
    658             formatvalue = 'jpeg' 
     663            self.format_value = 'jpeg' 
    659664            self.configuration['screenshot']['format'] = 'jpeg' 
    660665 
    661         if self.itakaglobals.notifyavailable: 
    662             notifyvalue = self.preferencesChecknotifications.get_active() 
    663             if notifyvalue: 
    664                 notifyvalue = True 
    665                 self.menuitemnotifications.set_active(True) 
     666        if self.itaka_globals.notify_available: 
     667            self.notify_value = self.check_preferences_notifications.get_active() 
     668            if self.notify_value: 
     669                self.notify_value = True 
     670                self.menu_item_notifications.set_active(True) 
    666671                self.configuration['server']['notify'] = True 
    667672            else: 
    668                 notifyvalue = False 
    669                 self.menuitemnotifications.set_active(False) 
     673                self.notify_value = False 
     674                self.menu_item_notifications.set_active(False) 
    670675                self.configuration['server']['notify'] = False 
    671676        else: 
    672             notifyvalue = False 
     677            self.notify_value = False 
    673678            self.configuration['server']['notify'] = False 
    674679 
    675         if not self.itakaglobals.system == 'nt': 
    676             if self.preferencesComboscreenshot.get_active_text() == _('Active window'): 
     680        if not self.itaka_globals.system == 'nt': 
     681            if self.combo_preferences_screenshot.get_active_text() == _('Active window'): 
    677682                self.configuration['screenshot']['currentwindow'] = True 
    678                 screenshotvalue = True 
     683                self.screenshot_value = True 
    679684            else: 
    680685                self.configuration['screenshot']['currentwindow'] = False 
    681                 screenshotvalue = False 
    682         else: 
    683             screenshotvalue = False 
     686                self.screenshot_value = False 
     687        else: 
     688            self.screenshot_value = False 
    684689            self.configuration['screenshot']['currentwindow'] = False 
    685690 
    686         scale = [self.preferencesSpinscale.get_value_as_int()] 
    687         if scale[0] == 100: 
     691        self.scale_value = [self.spin_preferences_scale.get_value_as_int()] 
     692        if self.scale_value[0] == 100: 
    688693            self.configuration['screenshot']['scale'] = False 
    689             scale.append(False) 
     694            self.scale_value.append(False) 
    690695        else: 
    691696            self.configuration['screenshot']['scale'] = True 
    692             scale.append(True) 
    693  
    694         if self.configuration['screenshot']['scalepercent'] != scale[0]: 
    695             self.configuration['screenshot']['scalepercent'] = scale[0] 
     697            self.scale_value.append(True) 
     698 
     699        if self.configuration['screenshot']['scalepercent'] != self.scale_value[0]: 
     700            self.configuration['screenshot']['scalepercent'] = self.scale_value[0] 
    696701         
    697702        # Build a configuration dictionary to send to the configuration engine's 
     
    704709            'screenshot':  
    705710                {'path': self.configuration['screenshot']['path'], 
    706                 'format': formatvalue, 
    707                 'quality': self.preferencesSpinquality.get_value_as_int(), 
    708                 'currentwindow': screenshotvalue, 
    709                 'scale': scale[1], 
    710                 'scalepercent': scale[0]}, 
     711                'format': self.format_value, 
     712                'quality': self.spin_preferences_quality.get_value_as_int(), 
     713                'currentwindow': self.screenshot_value, 
     714                'scale': self.scale_value[1], 
     715                'scalepercent': self.scale_value[0]}, 
    711716 
    712717            'server':  
    713                 {'username': self.preferencesEntryuser.get_text(), 
    714                 'authentication': self.preferencesCheckauth.get_active(), 
    715                 'notify': notifyvalue, 
    716                 'password': self.preferencesEntrypass.get_text(), 
    717                 'port': self.preferencesSpinport.get_value_as_int()} 
     718                {'username': self.entry_preferences_user.get_text(), 
     719                'authentication': self.check_preferences_auth.get_active(), 
     720                'notify': self.notify_value, 
     721                'password': self.entry_preferences_pass.get_text(), 
     722                'port': self.spin_preferences_port.get_value_as_int()} 
    718723            } 
    719724 
    720725        # Set them for local use now 
    721         if self.configuration['screenshot']['quality'] != self.preferencesSpinquality.get_value_as_int(): 
    722             self.configuration['screenshot']['quality'] = self.preferencesSpinquality.get_value_as_int() 
    723  
    724         if self.configuration['server']['port'] !=  self.preferencesSpinport.get_value_as_int(): 
    725             self.configuration['server']['port'] =  self.preferencesSpinport.get_value_as_int() 
     726        if self.configuration['screenshot']['quality'] != self.spin_preferences_quality.get_value_as_int(): 
     727            self.configuration['screenshot']['quality'] = self.spin_preferences_quality.get_value_as_int() 
     728 
     729        if self.configuration['server']['port'] !=  self.spin_preferences_port.get_value_as_int(): 
     730            self.configuration['server']['port'] =  self.spin_preferences_port.get_value_as_int() 
    726731            self.restart_server() 
    727732 
    728         if self.configuration['server']['authentication'] is not self.preferencesCheckauth.get_active(): 
    729             self.configuration['server']['authentication'] = self.preferencesCheckauth.get_active() 
    730  
    731         if self.configuration['server']['username'] != self.preferencesEntryuser.get_text(): 
    732             self.configuration['server']['username'] = self.preferencesEntryuser.get_text() 
    733  
    734         if self.configuration['server']['password'] != self.preferencesEntrypass.get_text(): 
    735             self.configuration['server']['password'] = self.preferencesEntrypass.get_text() 
     733        if self.configuration['server']['authentication'] is not self.check_preferences_auth.get_active(): 
     734            self.configuration['server']['authentication'] = self.check_preferences_auth.get_active() 
     735 
     736        if self.configuration['server']['username'] != self.entry_preferences_user.get_text(): 
     737            self.configuration['server']['username'] = self.entry_preferences_user.get_text() 
     738 
     739        if self.configuration['server']['password'] != self.entry_preferences_pass.get_text(): 
     740            self.configuration['server']['password'] = self.entry_preferences_pass.get_text() 
    736741 
    737742        # Check if the configuration changed 
    738         if (self.configurationdict != self.currentconfiguration): 
     743        if (self.configurationdict != self.current_configuration): 
    739744 
    740745            # Update the needed keys 
    741746            try: 
    742                 # self.configinstance.save(self.configurationdict) 
     747                # self.config_instance.save(self.configurationdict) 
    743748                for section in self.configurationdict: 
    744                     [self.configinstance.update(section, key, value) for key, value in self.configurationdict[section].iteritems() if key not in self.currentconfiguration[section] or self.currentconfiguration[section][key] != value] 
     749                    [self.config_instance.update(section, key, value) for key, value in self.configurationdict[section].iteritems() if key not in self.current_configuration[section] or self.current_configuration[section][key] != value] 
    745750            except: 
    746751                self.log.failure(('Gui', 'save_preferences'), _('Could not save preferences'), 'ERROR') 
     
    754759        # See configure-event signal of gtk.Widget 
    755760        # start timer, resize, catch configure-notify, set up idle handler, when idle resize to what the size should be at this point of time, repeat 
    756         if not self.preferencesexpanded: 
    757             if self.expandtimeout is not None: 
     761        if not self.preferences_expanded: 
     762            if self.timeout_expand is not None: 
    758763                """NOTE: GTK+ GtkWidget.size_request() method can give you the amount of size a widget will take 
    759                 however, it has to be show()ned before. For our little hack, we show the preferencesVBox widgets 
     764                however, it has to be show()ned before. For our little hack, we show the vbox_preferences widgets 
    760765                but not itself, which should yield a close enough calculation.""" 
    761                 self.preferencesFramesettings.show_all() 
    762                 self.preferencesHBox10.show_all() 
     766                self.frame_preference_settings.show_all() 
     767                self.hbox_preferences_10.show_all() 
    763768 
    764769                """If the logger is expanded, use that as the initial size.  
     
    776781 
    777782                self.increment = 33 
    778                 if self.window.current_size[1] < self.window.normal_size[1]+self.preferencesVBox.size_request()[1]: 
     783                if self.window.current_size[1] < self.window.normal_size[1]+self.vbox_preferences.size_request()[1]: 
    779784                    # Avoid overexpanding our calculation 
    780                     if self.window.current_size[1]+self.increment > self.window.normal_size[1]+self.preferencesVBox.size_request()[1]:  
    781                         self.increment = (self.window.normal_size[1]+self.preferencesVBox.size_request()[1] - self.window.current_size[1])  
     785                    if self.window.current_size[1]+self.increment > self.window.normal_size[1]+self.vbox_preferences.size_request()[1]:  
     786                        self.increment = (self.window.normal_size[1]+self.vbox_preferences.size_request()[1] - self.window.current_size[1])  
    782787 
    783788                    self.window.resize(self.window.current_size[0], self.window.current_size[1]+self.increment) 
     
    785790                else: 
    786791                    # Its done expanding, add our widgets or display it if it has been done already 
    787                     self.preferencesButton.set_sensitive(False) 
    788                     self.preferencesexpanded = True 
     792                    self.button_preferences.set_sensitive(False) 
     793                    self.preferences_expanded = True 
    789794 
    790795                    # Reload our configuration and show the preferences 
    791                     self.configuration = self.configinstance.load() 
    792                     if self.preferenceshidden: 
    793                         self.preferencesVBox.show_all() 
     796                    self.configuration = self.config_instance.load() 
     797                    if self.preferences_hidden: 
     798                        self.vbox_preferences.show_all() 
    794799                    else: 
    795                         self.vbox.pack_start(self.preferencesVBox, False, False, 0) 
    796                         self.preferencesVBox.show_all() 
     800                        self.vbox.pack_start(self.vbox_preferences, False, False, 0) 
     801                        self.vbox_preferences.show_all() 
    797802                     
    798                     self.expandtimeout = None 
     803                    self.timeout_expand = None 
    799804                    return False 
    800805            else: 
    801                 self.expandtimeout = gobject.timeout_add(30, self.expandpreferences) 
     806                self.timeout_expand = gobject.timeout_add(30, self.expandpreferences) 
    802807 
    803808    def contractpreferences(self, *args): 
     
    806811        """ 
    807812 
    808         if self.contracttimeout is not None: 
     813        if self.timeout_contract is not None: 
    809814            # If you dont use the normal_size proxy to our window sizes, 
    810815            # it generates a nice effect of doing the animation when closing the expander also.  
     
    816821                self.window.normal_size = self.window.initial_size 
    817822            
    818             if self.preferencesVBox.get_property("visible"): 
    819                 self.preferencesVBox.hide_all() 
     823            if self.vbox_preferences.get_property("visible"): 
     824                self.vbox_preferences.hide_all() 
    820825 
    821826            if self.window.current_size[1] > self.window.normal_size[1]: 
     
    824829            else: 
    825830                # Done, set some variables and stop our timer 
    826                 self.preferencesexpanded = False  
    827                 self.preferenceshidden = True 
     831                self.preferences_expanded = False  
     832                self.preferences_hidden = True 
    828833                self.expander.size_finalized = False 
    829                 self.preferencesButton.set_sensitive(True) 
     834                self.button_preferences.set_sensitive(True) 
    830835                 
    831836                # Save our settings  
    832837                self.save_preferences() 
    833838 
    834                 self.contracttimeout = None 
     839                self.timeout_contract = None 
    835840                return False 
    836841        else: 
    837             self.contracttimeout = gobject.timeout_add(30, self.contractpreferences) 
     842            self.timeout_contract = gobject.timeout_add(30, self.contractpreferences) 
    838843 
    839844    def windowsizechanged(self, widget=None, data=None): 
     
    854859            self.expander_size = self.window.current_size 
    855860            # If the preferences were expanded before the logger 
    856             if self.preferencesexpanded: 
     861            if self.preferences_expanded: 
    857862                # Cant assign tuple items 
    858                 self.expander_size = [self.expander_size[0], self.expander_size[1] - self.preferencesVBox.size_request()[1]] 
    859  
    860     def statusicon_menu(self, widget, button, time, menu): 
     863                self.expander_size = [self.expander_size[0], self.expander_size[1] - self.vbox_preferences.size_request()[1]] 
     864 
     865    def status_icon_menu(self, widget, button, time, menu): 
    861866        """ 
    862867        Display the menu on the status icon 
     
    881886            pass 
    882887 
    883     def statusicon_blinktimeout(self, time=3000): 
     888    def status_icon_timeout_blink(self, time=3000): 
    884889        """ 
    885890        Sets the timeout in miliseconds to blink and stop blinking the status icon 
     
    889894        """ 
    890895 
    891         if self.blinktimeout is None: 
    892             self.statusIcon.set_blinking(True) 
    893             self.blinktimeout = gobject.timeout_add(time, self.statusicon_blinktimeout) 
    894         else: 
    895             self.statusIcon.set_blinking(False) 
    896             self.blinktimeout = None 
     896        if self.timeout_blink is None: 
     897            self.status_icon.set_blinking(True) 
     898            self.timeout_blink = gobject.timeout_add(time, self.status_icon_timeout_blink) 
     899        else: 
     900            self.status_icon.set_blinking(False) 
     901            self.timeout_blink = None 
    897902            return False 
    898903  
    899     def statusicon_activate(self, widget): 
     904    def status_icon_activate(self, widget): 
    900905        """ 
    901906        Toggle the window visibility from the status icon when clicked 
     
    912917            self.window.show() 
    913918 
    914     def statusicon_notify(self, widget): 
     919    def status_icon_notify(self, widget): 
    915920        """ 
    916921        Disable or enable notifications on the fly from the status icon 
     
    920925        """ 
    921926 
    922         if self.checkwidget(self.menuitemnotifications): 
     927        if self.check_widget(self.menu_item_notifications): 
    923928            self.configuration['server']['notify'] = True 
    924929        else: 
     
    930935        """ 
    931936 
    932         self.aboutdialog = gtk.AboutDialog() 
    933         self.aboutdialog.set_transient_for(self.window) 
    934         self.aboutdialog.set_name('Itaka') 
    935         self.aboutdialog.set_version(self.itakaglobals.version) 
    936         self.aboutdialog.set_copyright(u'© 2003-2007 Marc E.') 
    937         self.aboutdialog.set_comments('Screenshooting de mercado.') 
    938         self.aboutdialog.set_authors(['Marc E. <santusmarc@users.sourceforge.net>', _('Kurt Erickson <psychogenicshk@users.sourceforge.net> (Packaging)')]) 
    939         self.aboutdialog.set_artists(['Marc E. <santusmarc@users.sourceforge.net>', 'Tango Project (http://tango.freedesktop.org)']) 
    940         self.aboutdialog.set_license('''Itaka is free software; you can redistribute it and/or modify 
     937        self.about_dialog = gtk.about_dialog() 
     938        self.about_dialog.set_transient_for(self.window) 
     939        self.about_dialog.set_name('Itaka') 
     940        self.about_dialog.set_version(self.itaka_globals.__version__) 
     941        self.about_dialog.set_copyright(u'© 2003-2007 Marc E.') 
     942        self.about_dialog.set_comments('Screenshooting de mercado.') 
     943        self.about_dialog.set_authors(['Marc E. <santusmarc@users.sourceforge.net>', _('Kurt Erickson <psychogenicshk@users.sourceforge.net> (Packaging)')]) 
     944        self.about_dialog.set_artists(['Marc E. <santusmarc@users.sourceforge.net>', 'Tango Project (http://tango.freedesktop.org)']) 
     945        self.about_dialog.set_license('''Itaka is free software; you can redistribute it and/or modify 
    941946it under the terms of the GNU General Public License as published by 
    942 the Free Software Foundation; either version 2 of the License, or 
     947the Free Software Foundation; either version 3 of the License, or 
    943948any later version. 
    944949 
     
    951956along with Itaka; if not, write to the Free Software 
    952957Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA''') 
    953         self.aboutdialog.set_website('http://itaka.jardinpresente.com.ar') 
    954         self.aboutdialog.set_logo(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itakaglobals.image_dir, "itaka64x64.png"))) 
    955         self.aboutdialog.set_icon(self.icon_pixbuf) 
    956         self.aboutdialog.run() 
    957         self.aboutdialog.destroy() 
     958        self.about_dialog.set_website('http://itaka.jardinpresente.com.ar') 
     959        self.about_dialog.set_logo(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itaka_globals.image_dir, "itaka64x64.png"))) 
     960        self.about_dialog.set_icon(self.icon_pixbuf) 
     961        self.about_dialog.run() 
     962        self.about_dialog.destroy() 
    958963 
    959964    def expandlogger(self, expander, params): 
     
    970975        if self.expander.get_expanded(): 
    971976            # Show the debugvbox() and it's subwidgets 
    972             self.logvbox.show_all() 
    973  
    974             self.expander.add(self.logvbox) 
     977            self.vbox_log.show_all() 
     978 
     979            self.expander.add(self.vbox_log) 
    975980        else: 
    976981            self.expander.remove(self.expander.child) 
     
    983988        """ 
    984989 
    985         self.logeventsstore.clear() 
    986         self.logdetailsbuffer.set_text("") 
     990        self.log_events_store.clear() 
     991        self.log_details_buffer.set_text("") 
    987992 
    988993    def button_pause_log(self, widget): 
     
    994999        """ 
    9951000 
    996         if self.checkwidget(widget): 
     1001        if self.check_widget(widget): 
    9971002            if not self.log_paused(): 
    9981003                self.pause_log() 
     
    10061011        """ 
    10071012 
    1008         self.logeventsstore.append([self.logeventstreeview.render_icon(stock_id=gtk.STOCK_MEDIA_PAUSE, size=gtk.ICON_SIZE_MENU, detail=None), _('Logging paused')]) 
    1009          
    1010         self.logeventstreeview.set_sensitive(False) 
    1011         self.logdetailstextview.set_sensitive(False) 
     1013        self.log_events_store.append([self.log_events_tree_view.render_icon(stock_id=gtk.STOCK_MEDIA_PAUSE, size=gtk.ICON_SIZE_MENU, detail=None), _('Logging paused')]) 
     1014         
     1015        self.log_events_tree_view.set_sensitive(False) 
     1016        self.log_details_text_view.set_sensitive(False) 
    10121017 
    10131018        self.server.remove_log_observer() 
    1014         self.logpaused = True 
     1019        self.log_is_paused = True 
    10151020 
    10161021    def unpause_log(self, foreign=False): 
     
    10241029        self.server.add_log_observer(self.log.twisted_observer) 
    10251030        if (foreign): 
    1026             self.logpausebutton.set_active(False) 
    1027         self.logdetailstextview.set_sensitive(True) 
    1028         self.logeventstreeview.set_sensitive(True) 
    1029  
    1030         self.logeventsstore.append([self.logeventstreeview.render_icon(stock_id=gtk.STOCK_MEDIA_PLAY, size=gtk.ICON_SIZE_MENU, detail=None), _('Logging resumed')]) 
    1031  
    1032         self.logpaused = False 
     1031            self.button_log_pause.set_active(False) 
     1032        self.log_details_text_view.set_sensitive(True) 
     1033        self.log_events_tree_view.set_sensitive(True) 
     1034 
     1035        self.log_events_store.append([self.log_events_tree_view.render_icon(stock_id=gtk.STOCK_MEDIA_PLAY, size=gtk.ICON_SIZE_MENU, detail=None), _('Logging resumed')]) 
     1036 
     1037        self.log_is_paused = False 
    10331038 
    10341039    def log_paused(self): 
     
    10371042 
    10381043        @rtype: bool 
    1039         @return: True if the Gui log is paused. False otherwise 
    1040         """ 
    1041          
    1042         return self.logpaused 
     1044        @return: True if the Gui log is paused 
     1045        """ 
     1046         
     1047        return self.log_is_paused 
    10431048 
    10441049    def main(self): 
     
    10581063        """ 
    10591064         
    1060         if self.preferencesComboformat.get_active_text() == 'PNG': 
    1061             self.preferencesHBox6.set_sensitive(False) 
    1062         else: 
    1063             self.preferencesHBox6.set_sensitive(True) 
     1065        if self.combo_preferences_format.get_active_text() == 'PNG': 
     1066            self.hbox_preferences_6.set_sensitive(False) 
     1067        else: 
     1068            self.hbox_preferences_6.set_sensitive(True) 
    10641069 
    10651070    def _preferences_authentication_toggled(self, widget): 
     
    10711076        """ 
    10721077 
    1073         if self.checkwidget(widget): 
    1074             self.preferencesEntryuser.set_sensitive(True) 
    1075             self.preferencesEntrypass.set_sensitive(True) 
    1076             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, "itaka-secure.png")) 
    1077             self.statusIcon.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itakaglobals.image_dir, "itaka-secure.png"))) 
    1078         else: 
    1079             self.preferencesEntryuser.set_sensitive(False) 
    1080             self.preferencesEntrypass.set_sensitive(False) 
    1081             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, "itaka.png")) 
    1082             self.statusIcon.set_from_pixbuf(self.icon_pixbuf) 
    1083  
    1084  
    1085     def checkwidget(self, widget): 
     1078        if self.check_widget(widget): 
     1079            self.entry_preferences_user.set_sensitive(True) 
     1080            self.entry_preferences_pass.set_sensitive(True) 
     1081            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, "itaka-secure.png")) 
     1082            self.status_icon.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(os.path.join(self.itaka_globals.image_dir, "itaka-secure.png"))) 
     1083        else: 
     1084            self.entry_preferences_user.set_sensitive(False) 
     1085            self.entry_preferences_pass.set_sensitive(False) 
     1086            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, "itaka.png")) 
     1087            self.status_icon.set_from_pixbuf(self.icon_pixbuf) 
     1088 
     1089 
     1090    def check_widget(self, widget): 
    10861091        """ 
    10871092        Checks if a gtk.Widget is active 
     
    11031108        @param widget: gtk.Widget 
    11041109        """ 
    1105         if self.checkwidget(widget): 
     1110        if self.check_widget(widget): 
    11061111            self.start_server() 
    11071112        else: 
     
    11161121 
    11171122        @type foreign: bool 
    1118         @param foreign: Whether the caller of this method is not self.buttonStartstop 
     1123        @param foreign: Whether the caller of this method is not self.button_start_stop 
    11191124 
    11201125        """ 
     
    11261131        except error.ItakaServerErrorCannotListen, e: 
    11271132            self.log.failure(('Gui', 'start_server'), (_('Failed to start server'), _('Failed to start server: %s') % (e)), 'ERROR') 
    1128             self.buttonStartstop.set_active(False) 
     1133            self.button_start_stop.set_active(False) 
    11291134            return 
    11301135 
     
    11451150        # Change buttons 
    11461151        if foreign: 
    1147             self.buttonStartstop.set_active(True) 
    1148         self.buttonStartstop.set_label(_('Stop')) 
    1149         self.startstopimage.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_BUTTON) 
    1150         self.buttonStartstop.set_image(self.startstopimage) 
    1151  
    1152         self.statusIcon.set_tooltip(_('Itaka - Server running')) 
    1153         self.menuitemstart.set_sensitive(False) 
    1154         self.menuitemstop.set_sensitive(True) 
     1152            self.button_start_stop.set_active(True) 
     1153        self.button_start_stop.set_label(_('Stop')) 
     1154        self.start_stop_image.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_BUTTON) 
     1155        self.button_start_stop.set_image(self.start_stop_image) 
     1156 
     1157        self.status_icon.set_tooltip(_('Itaka - Server running')) 
     1158        self.menu_item_start.set_sensitive(False) 
     1159        self.menu_item_stop.set_sensitive(True) 
    11551160 
    11561161        if not self.expander.get_property("sensitive"): 
     
    11651170 
    11661171        @type foreign: bool 
    1167         @param foreign: Whether the caller of this method is not self.buttonStartstop 
     1172        @param foreign: Whether the caller of this method is not self.button_start_stop 
    11681173        """ 
    11691174 
     
    11801185            # Change GUI elements 
    11811186            if (foreign): 
    1182                 self.buttonStartstop.set_active(False) 
    1183  
    1184             self.statusIcon.set_tooltip('Itaka') 
    1185             self.startstopimage.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON) 
    1186             self.buttonStartstop.set_image(self.startstopimage) 
    1187             self.buttonStartstop.set_label(_('Start')) 
    1188             self.labelLastip.set_text('') 
    1189             self.labelTime.set_text('') 
    1190             self.labelServed.set_text('') 
    1191             self.menuitemstart.set_sensitive(True) 
    1192             self.menuitemstop.set_sensitive(False) 
     1187                self.button_start_stop.set_active(False) 
     1188 
     1189            self.status_icon.set_tooltip('Itaka') 
     1190            self.start_stop_image.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_BUTTON) 
     1191            self.button_start_stop.set_image(self.start_stop_image) 
     1192            self.button_start_stop.set_label(_('Start')) 
     1193            self.label_last_ip.set_text('') 
     1194            self.label_time.set_text('') 
     1195            self.label_served.set_text('') 
     1196            self.menu_item_start.set_sensitive(True) 
     1197            self.menu_item_stop.set_sensitive(False) 
    11931198 
    11941199    def restart_server(self): 
     
    12211226 
    12221227        # Windows fix 
    1223         del self.statusIcon 
     1228        del self.status_icon 
    12241229 
    12251230        gtk.main_quit() 
     
    12511256            self.pieces.append(self.plural(self.minutes, _('minute'))) 
    12521257 
    1253         self.labelTime.set_text(_('<b>When</b>: ') + ', '.join(self.pieces) + _(' ago')) 
    1254         self.labelTime.set_use_markup(True) 
     1258        self.label_time.set_text(_('<b>When</b>: ') + ', '.join(self.pieces) + _(' ago')) 
     1259        self.label_time.set_use_markup(True) 
    12551260 
    12561261        # Need this so it runs more than once 
     
    12781283         
    12791284        if self.configuration['server']['authentication']: 
    1280             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, "itaka-secure.png"))             
    1281         else: 
    1282             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, "itaka.png")) 
    1283  
    1284         self.statusIcon.set_from_pixbuf(self.icon_pixbuf) 
     1285            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, "itaka-secure.png"))             
     1286        else: 
     1287            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, "itaka.png")) 
     1288 
     1289        self.status_icon.set_from_pixbuf(self.icon_pixbuf) 
    12851290        # Only run this event once 
    12861291        return False 
     
    13051310        self.time = time 
    13061311 
    1307         self.log.detailed_message(_('Screenshot served to %s') % (self.ip), _('Screenshot number %d served to %s') % (self.counter, self.ip), ['pixbuf', gtk.gdk.pixbuf_new_from_file(os.path.join(self.itakaglobals.image_dir, "itaka16x16-take.png"))]) 
    1308  
    1309         self.labelServed.set_text(_('<b>Served</b>: %d') % (self.counter)) 
    1310         self.labelServed.set_use_markup(True) 
    1311         self.labelLastip.set_text(_('<b>Client</b>: %s') % (self.ip)) 
    1312         self.labelLastip.set_use_markup(True) 
    1313         self.statusIcon.set_tooltip(_('Itaka - %s served') % (self.plural(self.counter, _('screenshot')))) 
     1312        self.log.detailed_message(_('Screenshot served to %s') % (self.ip), _('Screenshot number %d served to %s') % (self.counter, self.ip), ['pixbuf', gtk.gdk.pixbuf_new_from_file(os.path.join(self.itaka_globals.image_dir, "itaka16x16-take.png"))]) 
     1313 
     1314        self.label_served.set_text(_('<b>Served</b>: %d') % (self.counter)) 
     1315        self.label_served.set_use_markup(True) 
     1316        self.label_last_ip.set_text(_('<b>Client</b>: %s') % (self.ip)) 
     1317        self.label_last_ip.set_use_markup(True) 
     1318        self.status_icon.set_tooltip(_('Itaka - %s served') % (self.plural(self.counter, _('screenshot')))) 
    13141319 
    13151320        # Show the camera image on tray and interface for 1.5 seconds 
    13161321        if self.configuration['server']['authentication']: 
    1317             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka-secure-take.png')) 
    1318         else: 
    1319             self.itakaLogo.set_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka-take.png')) 
    1320         self.statusIcon.set_from_file(os.path.join(self.itakaglobals.image_dir, 'itaka-take.png')) 
     1322            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka-secure-take.png')) 
     1323        else: 
     1324            self.itaka_logo.set_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka-take.png')) 
     1325        self.status_icon.set_from_file(os.path.join(self.itaka_globals.image_dir, 'itaka-take.png')) 
    13211326        gobject.timeout_add(1500, self.set_standard_images) 
    13221327 
Note: See TracChangeset for help on using the changeset viewer.