Changeset 1325

Show
Ignore:
Timestamp:
05/11/08 08:58:28 (2 months ago)
Author:
klattimer
Message:

code cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wine-doors/branches/0.2/src/engines/__init__.py

    r1314 r1325  
    55# Constants  
    66class Engines: 
    7     def __init__( self, parent, engine=None, version=None ): 
     7    def ___init__( self, parent, engine=None, version=None ): 
    88        """ 
    99        Init function 
     
    5959 
    6060class default: 
     61    def __init__ (self): 
     62        pass 
     63 
     64    def __debug( self, command ): 
     65        """ 
     66        Capture all debugging output, winedbg and crashes. Process it to  
     67        make it useful Execution should take place inside of a thread to 
     68        prevent it blocking the UI.  
     69        """ 
     70        pass 
     71    def __execute( self, command ): 
     72        """ 
     73        Surpress all but fatal wine messages, catch winedbg and crashes.  
     74        Execution should take place inside of a thread to prevent it  
     75        blocking the UI.  
     76        """ 
     77        pass 
     78 
     79    def __get_status( self ): 
     80        pass 
     81    def __get_output( self ): 
     82        pass 
     83    def __parse_output( self ): 
     84        pass 
     85    def __strip_executable( self, string ): 
     86        """ 
     87        Strip executable from the start of a string of a command string  
     88        if detected 
     89        """ 
     90        if not string: 
     91            string = "" 
     92        return string 
     93 
     94    def __get_executable( self, string ): 
     95        """ 
     96        Capture the executable from the start of a string of a command string 
     97        if detected 
     98        """ 
     99 
     100        if not string: 
     101            raise ("Executable not found in string") 
     102 
     103        return string 
     104 
     105    def __is_file( self, filename ): 
     106        """ 
     107        test whether or not we can address the file, returns the unixpath of 
     108        file, otherwise returns false 
     109        """ 
     110        if os.path.isfile( filename ): 
     111            return filename 
     112        elif os.path.isfile( self.__get_unixpath( filename ) ): 
     113            return self.__get_unixpath( filename ) 
     114  
     115        winepath = self.__in_winepath( filename ) 
     116        if winepath: 
     117            filename = self.__get_unixpath( winepath ) 
     118 
     119        if os.path.isfile( filename ): 
     120            return filename 
     121 
     122        return False 
     123 
     124    def __in_winepath( self, filename ): 
     125        """ 
     126        returns the winepath of the file if found in the winepath, otherwise 
     127        returns false 
     128        """ 
     129        pass 
     130    def __set_program_files_dir( self, path ): 
     131        """ 
     132        Set the registry path of the program files dir 
     133        """ 
     134        pass 
     135    def __set_windows_dir( self, path ): 
     136        """ 
     137        Set the registry path of the windows dir 
     138        """ 
     139        pass 
     140    def __set_documents_dir( self, path ): 
     141        """ 
     142        Set the registry path of the documents dir 
     143        """ 
     144        pass 
     145    def __set_desktop_dir( self, path ): 
     146        """ 
     147        Set the registry path of the desktop dir 
     148        """ 
     149        pass 
     150    def __get_program_files_dir( self ): 
     151        """ 
     152        Return the registry path of the program files dir 
     153        """ 
     154        pass 
     155    def __get_windows_dir( self ): 
     156        """ 
     157        Return the registry path of the windows dir 
     158        """ 
     159        pass 
     160    def __get_documents_dir( self ): 
     161        """ 
     162        Return the registry path of the documents dir 
     163        """ 
     164        pass 
     165    def __get_desktop_dir( self ): 
     166        """ 
     167        Return the registry path of the desktop dir 
     168        """ 
     169        pass 
     170    def __get_winepath( self, path ): 
     171        pass 
     172 
     173    def __get_unixpath( self, path ): 
     174        pass 
     175 
    61176    def SubmitCrashReport( self ): 
    62177        pass 
     
    73188            executable = "regedit.exe" 
    74189        else: 
    75             executable = self._get_executable(executable) 
    76  
    77         self.executable = self._is_file(executable) 
     190            executable = self.__get_executable(executable) 
     191 
     192        self.executable = self.__is_file(executable) 
    78193 
    79194    def GetCommand( self ): 
     
    96211            return arg_string 
    97212        elif isinstance(args, str): 
    98             return self._strip_executable(args) 
     213            return self.__strip_executable(args) 
    99214        else: 
    100215            return str 
     
    105220        """ 
    106221        if isinstance(args, str): 
    107             return self._strip_executable(args).split(" ") 
     222            return self.__strip_executable(args).split(" ") 
    108223        elif isinstance(args, list): 
    109224            return args 
     
    134249 
    135250        if self.debug: 
    136             self.return_value = self._debug( self.GetCommand() ) 
    137             self.output = self._get_output() 
    138         else: 
    139             self.return_value = self._execute( self.GetCommand() ) 
    140             self.output = self._get_output() 
    141  
    142         self._parse_output() 
    143  
    144     def _debug( self, command ): 
    145         """ 
    146         Capture all debugging output, winedbg and crashes. Process it to  
    147         make it useful Execution should take place inside of a thread to 
    148         prevent it blocking the UI.  
    149         """ 
    150         pass 
    151     def _execute( self, command ): 
    152         """ 
    153         Surpress all but fatal wine messages, catch winedbg and crashes.  
    154         Execution should take place inside of a thread to prevent it  
    155         blocking the UI.  
    156         """ 
    157         pass 
    158  
    159     def _get_status( self ): 
    160         pass 
    161     def _get_output( self ): 
    162         pass 
    163     def _parse_output( self ): 
    164         pass 
    165     def _strip_executable( self, string ): 
    166         """ 
    167         Strip executable from the start of a string of a command string  
    168         if detected 
    169         """ 
    170         if not string: 
    171             string = "" 
    172         return string 
    173  
    174     def _get_executable( self, string ): 
    175         """ 
    176         Capture the executable from the start of a string of a command string 
    177         if detected 
    178         """ 
    179  
    180         if not string: 
    181             raise ("Executable not found in string") 
    182  
    183         return string 
    184  
    185     def _is_file( self, filename ): 
    186         """ 
    187         test whether or not we can address the file, returns the unixpath of 
    188         file, otherwise returns false 
    189         """ 
    190         if os.path.isfile( filename ): 
    191             return filename 
    192         elif os.path.isfile( self._get_unixpath( filename ) ): 
    193             return self._get_unixpath( filename ) 
    194   
    195         winepath = self._in_winepath( filename ) 
    196         if winepath: 
    197             filename = self._get_unixpath( winepath ) 
    198  
    199         if os.path.isfile( filename ): 
    200             return filename 
    201  
    202         return False 
    203  
    204     def _in_winepath( self, filename ): 
    205         """ 
    206         returns the winepath of the file if found in the winepath, otherwise 
    207         returns false 
    208         """ 
    209         pass 
    210     def _set_program_files_dir( self, path ): 
    211         """ 
    212         Set the registry path of the program files dir 
    213         """ 
    214         pass 
    215     def _set_windows_dir( self, path ): 
    216         """ 
    217         Set the registry path of the windows dir 
    218         """ 
    219         pass 
    220     def _set_documents_dir( self, path ): 
    221         """ 
    222         Set the registry path of the documents dir 
    223         """ 
    224         pass 
    225     def _set_desktop_dir( self, path ): 
    226         """ 
    227         Set the registry path of the desktop dir 
    228         """ 
    229         pass 
    230     def _get_program_files_dir( self ): 
    231         """ 
    232         Return the registry path of the program files dir 
    233         """ 
    234         pass 
    235     def _get_windows_dir( self ): 
    236         """ 
    237         Return the registry path of the windows dir 
    238         """ 
    239         pass 
    240     def _get_documents_dir( self ): 
    241         """ 
    242         Return the registry path of the documents dir 
    243         """ 
    244         pass 
    245     def _get_desktop_dir( self ): 
    246         """ 
    247         Return the registry path of the desktop dir 
    248         """ 
    249         pass 
    250     def _get_winepath( self, path ): 
    251         pass 
    252  
    253     def _get_unixpath( self, path ): 
    254         pass 
     251            self.return_value = self.__debug( self.GetCommand() ) 
     252            self.output = self.__get_output() 
     253        else: 
     254            self.return_value = self.__execute( self.GetCommand() ) 
     255            self.output = self.__get_output() 
     256 
     257        self.__parse_output() 
     258 
     259    def CreateShortcut ( self ): 
     260        """ 
     261        Using code from deprecated.shortcuts.py to have shortcuts tied 
     262        to the engine type, as engines define the way in which a package 
     263        has been installed and the platform concerned 
     264        """ 
     265