Changeset 274


Ignore:
Timestamp:
07/28/09 01:31:05 (8 years ago)
Author:
marc
Message:

Better port bind fail error, better console print functions, better error names

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r270 r274  
    66 * Added RPM packages 
    77 * Switch to GPLv3 
    8  * Better console help 
     8 * Better error reporting on the main log 
     9 * Better console help and internal functions 
    910 * Don't clean out status labels when restarting server 
    1011 * Don't check for system compatibility of Libnotify 
  • trunk/console.py

    r271 r274  
    3636    print '[*] %s' % (str(string)) 
    3737 
    38 def print_warning(string): 
     38def print_warning(*strings): 
    3939    """ 
    40     Print wrapper. 
     40    Print warning wrapper. 
    4141 
    42     @type str: str 
    43     @param str: Message 
     42    @type *strings: anything 
     43    @param *strings: Anything 
    4444    """ 
    4545 
    46     print_m('WARNING: %s' % (string)) 
     46    print_m('WARNING: %s' % (" - ".join(str(item) for item in strings))) 
    4747 
    48 def print_error(string): 
     48def print_error(*strings): 
    4949    """ 
    50     Print wrapper. 
     50    Print error wrapper. 
    5151 
    52     @type str: str 
    53     @param str: Message 
     52    @type *strings: anything 
     53    @param *strings: Anything 
    5454    """ 
    5555 
    56     print_m('ERROR: %s' % (string)) 
     56    print_m('ERROR: %s' % (" - ".join(str(item) for item in strings))) 
    5757 
    58 def print_debug(string): 
     58def print_debug(*strings): 
    5959    """ 
    60     Print wrapper. 
     60    Print debug wrapper. 
    6161 
    62     @type str: str 
    63     @param str: Message 
     62    @type *strings: anything 
     63    @param *strings: Anything 
    6464    """ 
    6565 
    66     print_m('DEBUG: %s' % (string)) 
     66    print_m('DEBUG: %s' % (" - ".join(str(item) for item in strings))) 
    6767 
    6868# Register them for global use 
     
    7070__builtin__.print_error = print_error 
    7171__builtin__.print_warning = print_warning 
     72__builtin__.print_debug = print_debug 
    7273 
    7374class BaseMessage: 
  • trunk/error.py

    r273 r274  
    5656 
    5757 
    58 class ItakaServerErrorCannotListen(ItakaServerError): 
     58class ItakaServerCannotListenError(ItakaServerError): 
    5959    """ 
    6060    Exception raised by server methods 
     
    7070 
    7171 
    72 class ItakaScreenshotErrorWmHints(ItakaScreenshotError): 
     72class ItakaScreenshotWmHintsError(ItakaScreenshotError): 
    7373    """ 
    7474    Exception raised by screenshooting methods 
     
    7777 
    7878 
    79 class ItakaScreenshotErrorActiveDesktop(ItakaScreenshotError): 
     79class ItakaScreenshotActiveDesktopError(ItakaScreenshotError): 
    8080    """ 
    8181    Exception raised by screenshooting methods 
     
    8484     
    8585 
    86 class ItakaSaveScreenshotError(ItakaScreenshotError): 
     86class ItakaScreenshotSaveError(ItakaScreenshotError): 
    8787    """ 
    8888    Exception raised by screenshooting methods 
  • trunk/screenshot.py

    r271 r274  
    8787        else: 
    8888            self.current_window_failed = True 
    89             raise error.ItakaScreenshotErrorWmHints, _('Window Manager does not support _NET_WM hints') 
     89            raise error.ItakaScreenshotWmHintsError, _('Window Manager does not support _NET_WM hints') 
    9090     
    9191        # We do not want to grab the desktop window 
    9292        if self.active_window.property_get("_NET_WM_WINDOW_TYPE")[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP': 
    9393            self.current_window_failed = True 
    94             raise error.ItakaScreenshotErrorActiveDesktop, _('Active window is desktop') 
     94            raise error.ItakaScreenshotActiveDesktopError, _('Active window is desktop') 
    9595 
    9696        return (self.window_width, self.window_height, self.window_positionx, self.window_positiony) 
     
    111111            try: 
    112112                self.current_window = self.find_current_active_window() 
    113             except error.ItakaScreenshotErrorWmHints: 
     113            except error.ItakaScreenshotWmHintsError: 
    114114                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') 
    115             except error.ItakaScreenshotErrorActiveDesktop: 
     115            except error.ItakaScreenshotActiveDesktopError: 
    116116                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') 
    117117 
     
    162162        except: 
    163163            self.gui.log.failure(('Screenshot','take_screenshot'), (_('Could not save screenshot'), _('Could not save screenshot %s') % (traceback.format_exc())), 'ERROR') 
    164             raise error.ItakaSaveScreenshotError, _('Could not save screenshot') 
     164            raise error.ItakaScreenshotSaveError, _('Could not save screenshot') 
    165165 
    166166        # Important workaround to avoid a memory leak 
  • trunk/server.py

    r271 r274  
    118118            self.server = reactor.listenTCP(port, self.site) 
    119119        except twisted.internet.error.CannotListenError, e: 
    120             raise error.ItakaServerErrorCannotListen, e 
     120            raise error.ItakaServerCannotListenError, e 
    121121 
    122122        self.server_listening = True 
  • trunk/uigtk.py

    r273 r274  
    11491149        try: 
    11501150            self.server.start_server(self.configuration['server']['port']) 
    1151         except error.ItakaServerErrorCannotListen, e: 
    1152             self.log.failure(('Gui', 'start_server'), (_('Failed to start server: %s' % e.value), _('Failed to start server: %s') % e.value), 'ERROR') 
     1151        except error.ItakaServerCannotListenError, e: 
     1152            self.log.failure(('Gui', 'start_server'), (_('Failed to start server: port %s already in use' % e.value.port), _('Failed to start server: %s') % e.value), 'ERROR') 
    11531153            self.button_start_stop.set_active(False) 
    11541154            return 
Note: See TracChangeset for help on using the changeset viewer.