Changeset 49

Show
Ignore:
Timestamp:
12/09/07 21:29:40 (4 years ago)
Author:
dlefevre
Message:

Final documented source

Location:
mymrc/trunk/mymrc/src
Files:
32 modified

Legend:

Unmodified
Added
Removed
  • mymrc/trunk/mymrc/src/controllers/__init__.py

    r14 r49  
     1## @package controllers 
     2#  @brief controllers Package 
     3 
     4## @file controllers/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package controllers.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/controllers/audiocontroller.py

    r14 r49  
     1## @file controllers/audiocontroller.py 
     2#  @brief Contains the audio controller class 
     3 
     4## @package controllers.audiocontroller 
     5#  @brief Contains the audio controller class 
     6 
    17import sys, thread 
    28from settings.players import Players 
     
    410from popen2 import popen3 as popen 
    511 
     12## debuggin helper 
    613def printd(aString): 
    714    print aString 
    815 
     16 
     17## Controller base class 
    918class Controller( object ): 
     19     
     20 
     21    ## @brief The constructor 
     22    # 
     23    #  @param self The object pointer 
    1024    def __init__(self): 
    1125        if sys.platform == 'win32': 
    12             self._shell, self._tail = ('cmd', '\r\n') 
     26            ## Command tail 
     27            self._tail = '\r\n' 
    1328        else: 
    14             self._shell, self._tail = ('sh', '\n') 
     29            self._tail = '\n' 
     30 
    1531     
    16        
     32    ## @brief Run the command given 
     33    # 
     34    #  @param self The object pointer 
     35    #  @param aCommand Command to be run 
    1736    def cmd( self, aCommand ): 
    1837        try: 
     
    2544        return '0000', 'error' 
    2645     
     46     
     47    ## @brief The destructor. 
     48    # 
     49    #  @param self The object pointer     
    2750    def __del__( self ): 
    2851        # close I/O pipes 
     
    3659     
    3760     
    38      
     61 
     62## @brief Audio controller class. 
     63#     
    3964class AudioController( Controller, Players ): 
     65  
     66    ## @brief The constructor 
     67    # 
     68    #  @param self The object pointer 
    4069    def __init__(self): 
    4170        Controller.__init__(self) 
    4271        Players.__init__(self) 
     72         
     73        ## Player name (command) 
    4374        self._iPlayer = Settings().get("players", "audio") 
    4475        printd("Audio player: " + self._iPlayer) 
     76        ## Non braking space 
    4577        self._iNBSP = " " 
    46          
     78     
     79     
     80    ## @brief Play  
     81    #  @param self The object pointer         
     82    #  @param aFile Path of the file to play.  
    4783    def play(self, aFile=None): 
    4884        command = self.get(self._iPlayer, "start") + self._iNBSP + \ 
     
    5389        return "Play" 
    5490 
    55     def stop(self): 
     91 
     92    ## @brief Stop 
     93    # 
     94    #  @param self The object pointer 
     95    def stop( self ): 
    5696        command = self.get(self._iPlayer, "start")+ \ 
    5797                             self._iNBSP+self.get(self._iPlayer, "stop") 
    5898        return self.cmd(command) 
    5999         
     100         
     101    ## @brief Pause 
     102    # 
     103    #  @param self The object pointer         
    60104    def pause(self): 
    61105        command = self.get(self._iPlayer, "start")+\ 
     
    63107        return self.cmd(command) 
    64108     
     109     
     110    ## @brief Next 
     111    # 
     112    #  @param self The object pointer     
    65113    def next(self): 
    66114        command = self.get(self._iPlayer, "start")+\ 
     
    68116        return self.cmd(command) 
    69117     
     118     
     119    ## @brief Close 
     120    # 
     121    #  @param self The object pointer     
    70122    def close(self): 
    71123        command = self.get(self._iPlayer, "start")+\ 
    72124                             self._iNBSP+self.get(self._iPlayer, "close") 
    73125        return self.cmd(command) 
    74      
     126 
     127 
     128    ## @brief Previous 
     129    # 
     130    #  @param self The object pointer     
    75131    def previous(self): 
    76132        command = self.get(self._iPlayer, "start")+\ 
    77133                             self._iNBSP+self.get(self._iPlayer, "previous") 
    78134        return self.cmd(command) 
    79      
     135 
     136 
     137    ## @brief Forward 
     138    # 
     139    #  @param self The object pointer     
    80140    def forward(self): 
    81141        command = self.get(self._iPlayer, "start")+\ 
    82142                             self._iNBSP+self.get(self._iPlayer, "forward") 
    83143        return self.cmd(command) 
    84      
     144 
     145 
     146    ## @brief Backward 
     147    # 
     148    #  @param self The object pointer     
    85149    def backward(self): 
    86150        command = self.get(self._iPlayer, "start")+\ 
     
    88152        return self.cmd(command) 
    89153 
     154 
     155    ## @brief Volume up 
     156    # 
     157    #  @param self The object pointer 
    90158    def volume_up(self): 
    91159        command = self.get(self._iPlayer, "start")+\ 
     
    93161        return self.cmd(command) 
    94162 
    95     ## volume down. 
    96     #  @callgraph 
    97     #  @callergraph 
     163 
     164    ## @brief Volume down 
     165    # 
     166    #  @param self The object pointer 
    98167    def volume_down(self): 
    99168        command = self.get(self._iPlayer, "start")+\ 
     
    101170        return self.cmd(command) 
    102171      
     172      
     173    ## @brief Full screen 
     174    # 
     175    #  @param self The object pointer      
    103176    def fullscreen(self): 
    104177        command = self.get(self._iPlayer, "start")+\ 
     
    106179        return self.cmd(command) 
    107180      
     181      
     182    ## @brief Hide/show UI controls  
     183    # 
     184    #  @param self The object pointer      
    108185    def hide_show_controls(self): 
    109186        command = self.get(self._iPlayer, "start")+\ 
  • mymrc/trunk/mymrc/src/db/__init__.py

    r14 r49  
     1## @package db 
     2#  @brief db Package 
     3 
     4## @file db/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package db.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/db/audioqueries.py

    r41 r49  
     1## @file db/audioqueries.py 
     2#  @brief Contains the AudioQueries class 
     3 
     4## @package db.audioqueries 
     5#  @brief Contains the AudioQueries class 
     6 
     7 
     8# Contains the SQL queries for the database interaction 
    19from db.dbdriver import DBDriver 
    210from settings.settings import Settings 
     
    412 
    513 
     14## @brief Audio queries class 
     15# 
    616class AudioQueries(object): 
     17     
     18    ## @brief The constructor 
     19    # 
     20    #  @param self The object pointer 
    721    def __init__(self): 
    822        path = Settings().get('database', 'path') 
     23        ## Database instance 
    924        self._iDB = DBDriverClass(path) 
    1025     
     26 
     27    ## @brief Get all songs from the database 
     28    # 
     29    #  @param self The object pointer 
     30    #  @return Song list 
    1131    def allSongs(self): 
    1232        query = """SELECT audio_song.id AS id, 
     
    2545        return self._iDB.execute(query) 
    2646     
     47 
     48    ## @brief Get album list 
     49    # 
     50    #  @param self The object pointer 
     51    #  @return Album list 
    2752    def albums(self): 
    2853        query = """SELECT title FROM audio_album ORDER BY title;""" 
    2954        return self._iDB.execute(query)   
    3055     
    31     ## Get all songs from an album 
     56 
     57    ## @brief Get album's songs list 
     58    # 
     59    #  @param self The object pointer 
     60    #  @param aAlbumTitle Album title 
     61    #  @return Album songs list 
    3262    def albumSongs(self, aAlbumTitle): 
    3363        query = """SELECT audio_song.id AS id, 
     
    4777        return self._iDB.execute(query, (aAlbumTitle,))       
    4878     
     79 
     80    ## @brief Get artist list 
     81    # 
     82    #  @param self The object pointer 
     83    #  @param raw True/False. If false returns name list. If True returns all artist fields in a list. 
     84    #  @returns Artist list. 
    4985    def artists(self, raw=False): 
    5086        if raw: 
     
    5490        return self._iDB.execute(query)    
    5591     
    56     ## Get all songs from an artist 
     92     
     93    ## @brief Get all songs for an artist 
     94    # 
     95    #  @param self The object pointer 
     96    #  @param aArtistName Artist name 
     97    #  @return Artist songs list. 
    5798    def artistAllSongs(self, aArtistName): 
    5899        query = """ SELECT audio_song.id AS id, 
     
    73114     
    74115     
    75     ## Get the list of all albums from a given artist. 
     116    ## @brief Get the list of all albums for a given artist. 
     117    # 
     118    #  @param self The object pointer 
     119    #  @param aArtistName Artist name 
     120    #  @return Album list. 
    76121    def artistAlbums(self, aArtistName): 
    77122        query = """SELECT DISTINCT audio_album.title AS album 
     
    84129     
    85130     
    86     ## Get the list of all genres - those, that actually do have songs, would 
    87     #  be quite senseless to give the whole genre list, when most of them won't 
    88     #  have any songs anyway 
     131    ## @brief Get the list of genres  
     132    # 
     133    #  @param self The object pointer 
     134    #  @return Genres list 
    89135    def genres(self): 
    90136        query = """SELECT audio_genre.name AS genre 
     
    95141     
    96142     
    97     ## Get all songs from a genre 
     143    ## @brief Get all songs for a genre 
     144    # 
     145    #  @param self The object pointer 
     146    #  @param aGenre Genre 
     147    #  return Song list.  
    98148    def genreSongs(self, aGenre): 
    99149        query = """ 
     
    116166     
    117167     
    118     ## Add artist if not exists. 
    119     #  @param self The object pointer.  
     168    ## @brief Add artist if not exists. 
     169    # 
     170    #  @param self The object pointer. 
     171    #  @param aArtist Artist name 
     172    #  @return Query result  
    120173    def addArtist(self, aArtist): 
    121174        query = """INSERT INTO audio_artist(name) 
     
    129182     
    130183     
    131     ## Add album if not exists. 
     184    ## @brief Add album if not exists. 
     185    # 
    132186    #  @param self The object pointer. 
     187    #  @param aAlbum Album title 
     188    #  @return Query result 
    133189    def addAlbum(self, aAlbum): 
    134190        query = """INSERT INTO audio_album(title) 
     
    142198    
    143199     
    144     ## Get all available playlists. 
     200    ## @brief Get all available playlists. 
     201    # 
     202    #  @param self The object pointer 
     203    #  @param raw 
     204    #  @return Playlist list 
    145205    def playlists(self, raw=False): 
    146206        if raw: 
     
    150210        return self._iDB.execute(query) 
    151211     
    152     ## Get complete data from all songs from a playlist (taken from the playlist 
    153     #  ID, determined after the playlist was selected). 
    154     #  NOTE: this is not tested, just a guess. 
     212     
     213    ## @brief Get the playlist songs  
     214    # 
     215    #  @param self The object pointer 
     216    #  @param aPlaylist Playlist 
     217    #  @return Playlist list 
    155218    def playlistSongs(self, aPlaylist): 
    156219        query="""SELECT audio_song.id AS id, 
     
    170233ORDER BY audio_playlist_data.id;""" 
    171234        return self._iDB.execute(query, (aPlaylist,)) 
    172      
     235 
     236     
     237    ## @brief Get song path from a song ID 
     238    # 
     239    #  @param self The object pointer 
     240    #  @param aId Song ID 
     241    #  @return Song path 
    173242    def songById(self, aId): 
    174243        query = """ SELECT path FROM audio_song WHERE id=?""" 
    175244        return self._iDB.execute(query, (aId)) 
    176245     
     246 
     247    ## @brief Get song field from a song title 
     248    # 
     249    #  @param self The object pointer 
     250    #  @param aTitle Song title 
     251    #  @return Song fields in a list 
    177252    def songByTitle(self, aTitle): 
    178253        query = """ SELECT * FROM audio_song WHERE title=?""" 
    179254        return self._iDB.execute(query,(aTitle,)) 
    180255     
     256 
     257    ## @brief Add a song to playlist 
     258    # 
     259    #  @param self The object pointer 
     260    #  @param aPlaylistId Playlist ID 
     261    #  @param aSongId Song ID 
     262    #  @return Query result     
    181263    def addSongToPlaylist(self, aPlaylistId, aSongId): 
    182264        query = """ INSERT INTO audio_playlist_data(playlist_id, song_id)  
     
    185267     
    186268     
    187     ## Insert a whole artist into a playlist. 
     269    ## @brief Add all artist songs to playlist 
     270    # 
     271    #  @param self The object pointer 
     272    #  @param aArtist Artist name 
     273    #  @param aPlaylist Playlist name 
     274    #  @return Query result     
    188275    def addArtistToPlaylist(self, aArtist, aPlaylist): 
    189276        query = """INSERT INTO audio_playlist_data(playlist_id, song_id) 
     
    195282     
    196283     
    197     ## Insert a whole album into a playlist. 
     284    ## @brief Add album's song to playlist 
     285    # 
     286    #  @param self The object pointer 
     287    #  @param  aAlbum Album name 
     288    #  @param aPlaylist Playlist name 
     289    #  @return Query result     
    198290    def addAlbumToPlaylist(self, aAlbum, aPlaylist): 
    199291        print "aAlbum: ", aAlbum 
     
    207299     
    208300     
    209     ## Insert a whole genre into a playlist 
     301    ## @brief Add genre's songs to playlist 
     302    # 
     303    #  @param self The object pointer     
     304    #  @param aGenre Gernre name 
     305    #  @param aPlaylist Playlist name 
     306    #  @return Query result     
    210307    def addGenreToPlaylist(self, aGenre, aPlaylist): 
    211308        query = """INSERT INTO audio_playlist_data(playlist_id, song_id) 
     
    217314     
    218315     
    219     ## Delete a playlist 
     316    ## @brief Delete a playlist 
    220317    #  @note: since SQLite doesn't really deal with foreign keys, we can't just 
    221318    #  use an ON DELETE CASCADE in the table creation, so we have to delete 
    222319    #  all entries manually 
     320    #  @param self The object pointer 
     321    #  @param aPlaylist Play list id 
     322    #  @return Query result         
    223323    def deletePlaylist(self, aPlaylist): 
    224324        query = """DELETE FROM audio_playlist_data WHERE audio_playlist_id = ?; 
     
    228328     
    229329    ## Add song to database 
     330    ## @brief Get all songs from the database 
     331    # 
     332    #  @param self The object pointer 
     333    #  @param aPath Path 
     334    #  @param aTitle Title 
     335    #  @param aArtist Artist 
     336    #  @param aAlbum Album 
     337    #  @param aGenre Genre 
     338    #  @param aTrackNb Track number 
     339    #  @param aTime Time 
     340    #  @return Query result         
    230341    def addSong(self, aPath, aTitle, aArtist, aAlbum, aGenre, aTrackNb=None, aTime=None): 
    231342        query = """ INSERT INTO audio_artist(name) VALUES (?) WHERE NOT EXISTS((SELECT name FROM audio_artist WHERE name=?))""" 
  • mymrc/trunk/mymrc/src/db/dbdriver.py

    r38 r49  
     1## @file db/dbdriver.py 
     2#  @brief Contains the DBDriver and DBDriverClass classes 
     3 
     4## @package db.dbdriver 
     5#  @brief Contains the DBDriver and DBDriverClass classes 
     6 
    17import os.path 
    28from symbol import arglist 
     
    200206 
    201207 
    202 ## Settings class. 
    203 Used to retrieve settings from the configuration file. 
     208## @brief DBDriver singleton class. 
     209 
    204210class DBDriver( object ): 
    205211    ## Stores the unique Singleton instance- 
    206212    _iInstance = None 
    207213 
     214    ## @brief Nested class for the DBDriver singleton. 
     215    #   
    208216    class DBDriverClass( object ): 
     217         
     218        ## @brief The constructor 
     219        # 
     220        #  @param self The object pointer 
     221        #  @param aCwd Directory where the database "mymrc.db" is 
     222        #  @param connect True/False if True the connection is made when  
     223        #  create the class object if not connect needs to be called 
    209224        def __init__( self, aCwd, connect=True ): 
    210225            self._iDB = os.path.join(aCwd, "mymrc.db") 
     
    212227                self.connect( ) 
    213228     
     229         
     230        ## @brief Make a database connection 
     231        # 
     232        #  @param self The object pointer 
    214233        def connect( self ): 
    215234            from pysqlite2 import dbapi2 as sqlite 
     
    223242                self.executescript( template ) 
    224243     
     244         
     245        ## @brief Execute a query 
     246        #  @param self The object pointer 
     247        #  @param aQuery Query to execute 
     248        #  @param args Arguments for the query 
    225249        def execute( self, aQuery, args=[] ): 
    226250            resulset = self._iCur.execute( aQuery, args ) 
     
    228252            return resulset 
    229253         
     254         
     255        ## @brief Execute a SQL sript 
     256        #  @param self The object pointer 
     257        #  @param aScript SQL script to execute  
    230258        def executescript( self, aScript ): 
    231259            resulset = self._iCur.executescript( aScript ) 
     
    233261            return resulset 
    234262             
     263         
     264        ## @brief Get cursor instance 
     265        # 
     266        #  @param self The object pointer 
    235267        def getCursor( self ): 
    236268            return self._iCur 
    237269             
     270         
     271        ## @brief Get connection instance 
     272        # 
     273        #  @param self The object pointer 
    238274        def getConn( self ): 
    239275            return self._iConn 
    240276             
     277         
     278        ## @brief The destructor 
     279        # 
     280        #  @param self The object pointer 
    241281        def __del__( self ): 
    242282            self._iCur.close( ) 
    243283            self._iConn.close( ) 
    244284         
    245     ## The constructor 
    246     #  @param self The object pointer. 
     285    ## @brief The constructor 
     286    #  @param self The object pointer 
     287    #  @param aCwd Directory where the database "mymrc.db" is 
     288    #  @param connect True/False if True the connection is made when  
     289    #  create the class object if not connect needs to be called     
    247290    def __init__( self, aCwd=None, connect=True  ): 
    248291        # Check whether we already have an instance 
     
    255298     
    256299     
    257     ## Delegate access to implementation. 
     300    ## @brief Delegate access to implementation. 
    258301    #  @param self The object pointer. 
    259     #  @param attr Attribute wanted. 
     302    #  @param aAttr Attribute wanted. 
    260303    #  @return Attribute 
    261304    def __getattr__(self, aAttr): 
     
    263306  
    264307  
    265     ## Delegate access to implementation. 
     308    ## @brief Delegate access to implementation. 
    266309    #  @param self The object pointer. 
    267     #  @param attr Attribute wanted. 
    268     #  @param value Vaule to be set. 
     310    #  @param aAttr Attribute wanted. 
     311    #  @param aValue Vaule to be set. 
    269312    #  @return Result of operation. 
    270313    def __setattr__(self, aAttr, aValue): 
     
    274317     
    275318     
    276      
     319## @brief Database driver class. 
     320#     
    277321class DBDriverClass( object ): 
    278322    def __init__( self, aCwd, connect=True ): 
  • mymrc/trunk/mymrc/src/db_utils.py

    r42 r49  
     1## @file db_utils.py 
     2#  @brief db utilities script 
     3# 
     4#  Add song to database / Add directory to db / Add directory to db recursively 
     5 
     6## @package db_utils 
     7#  @brief db utilities script 
     8# 
     9#  Add song to database / Add directory to db / Add directory to db recursively 
     10 
     11## @class socket 
     12#  @brief Default socket class 
     13 
    114import os, os.path 
    215from db.audioqueries import AudioQueries 
  • mymrc/trunk/mymrc/src/errors/__init__.py

    r8 r49  
     1## @package errors 
     2#  @brief errors Package 
     3 
     4## @file errors/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package errors.__init__ 
     8#  @brief Package module and/or package loader 
     9 
     10## @class Exception 
     11#  @brief Exception base class 
     12 
     13## @package Exception 
     14#  @brief Exception base class 
  • mymrc/trunk/mymrc/src/errors/config.py

    r8 r49  
     1## @file errors/config.py 
     2#  @brief Contains the FileMissingError and DatabaseSectionError classes 
    13 
    2 ## Raised when the configuration file is missing 
     4## @package errors.config 
     5#  @brief Contains the FileMissingError and DatabaseSectionError classes 
     6 
     7 
     8## @brief Raised when the configuration file is missing 
     9# 
    310class FileMissingError(Exception): 
    411    #  @param self The object pointer 
     
    714         
    815 
    9 ## Raised when the a section in the configuration file is disformed         
     16## @brief Raised when the a section in the configuration file is disformed 
     17#         
    1018class DatabaseSectionError(Exception): 
    1119    #  @param self The object pointer. 
  • mymrc/trunk/mymrc/src/errors/networking.py

    r8 r49  
     1## @file errors/networking.py 
     2#  @brief Contains the NoInterfaceError class 
     3 
     4## @package errors.networking 
     5#  @brief Contains the NoInterfaceError class 
     6 
    17## Raised when no network interface has been configured. 
    28class NoInterfaceError( Exception ): 
  • mymrc/trunk/mymrc/src/errors/sqlite.py

    r8 r49  
     1## @file errors/sqlite.py 
     2#  @brief Contains the ImportErrorPySQLite class 
    13 
     4## @package errors.sqlite 
     5#  @brief Contains the ImportErrorPySQLite class 
    26         
    37## Raised when pySQLite2 isn't installed on the system. 
  • mymrc/trunk/mymrc/src/mobileclient/__init__.py

    r8 r49  
     1## @package mobileclient 
     2#  @brief mobileclient Package 
     3 
     4## @file mobileclient/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package mobileclient.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/mobileclient/appuifw.py

    r40 r49  
     1## @file mobileclient/appuifw.py 
     2#  @brief Contains the Listbox, Form and Canvas classes 
    13 
     4## @package mobileclient.appuifw 
     5#  @brief Contains the Listbox, Form and Canvas classes 
     6 
     7## @brief ListBox builder 
     8# 
    29class ListBox(object): 
    310    def __init__(self, aTitle): 
     
    1421        return self._iForm + """</list>""" 
    1522     
    16      
     23 
     24 
     25## @brief Form builder 
     26#     
    1727class Form(object): 
    1828    def __init__(self, aTitle): 
     
    5262        return self._iForm + """</form>""" 
    5363     
    54  
     64     
     65     
     66## @brief Canvas builder 
     67# 
    5568class Canvas(object): 
    5669    def __init__(self, aTitle, aLength=1234): 
  • mymrc/trunk/mymrc/src/mobileclient/audioview.py

    r29 r49  
     1## @file mobileclient/audioview.py 
     2#  @brief Contains the AudioView class 
     3 
     4## @package mobileclient.audioview 
     5#  @brief Contains the AudioView class 
     6 
    17from settings.lang import Lang 
    28from mobileclient.appuifw import ListBox 
    39from mobileclient.opcode import OPCode 
    410from db.audioqueries import AudioQueries 
    5     
     11 
     12 
     13## @brief Audio view builder/manager 
     14#    
    615class AudioView(object): 
     16     
     17    ## @brief The constructor 
     18    #  @param self The object pointer 
     19    #  @param aViewStack View stack (Array) reference 
     20    #  @param aActionStack Action stack (Array) reference 
     21    #  @param aListStack List stack (Array) reference 
    722    def __init__(self, aViewStack, aActionStack, aListStack): 
    823        self._iViewStack = aViewStack 
     
    1126        self._iDB = AudioQueries() 
    1227     
     28     
     29    ## @brief Main view 
     30    #  @param self The object pointer 
    1331    def main(self): 
    1432        print "Audio main" 
     
    4765        self._iListStack.append(id_list) 
    4866     
     67     
     68    ## @brief All songs view 
     69    #  
     70    #  @param self The object pointer 
    4971    def allSongs(self): 
    5072        print "Audio all songs" 
     
    7597      
    7698     
     99    ## @brief Artists view 
     100    #  
     101    #  @param self The object pointer 
    77102    def artists(self): 
    78103        print "Audio Artists" 
     
    103128     
    104129     
     130    ## @brief Artist albums view 
     131    #  
     132    #  @param self The object pointer 
     133    #  @param aArtistName Artist name 
    105134    def artistAlbums(self, aArtistName): 
    106135        print "Audio %s album" %(aArtistName) 
     
    137166     
    138167     
     168    ## @brief Album songs view 
     169    #  
     170    #  @param self The object pointer 
     171    #  @param aAlbum Album name 
    139172    def artistAlbumSongs(self, aAlbum): 
    140173        print "Audio artist album songs" 
     
    162195        self._iListStack.append(id_list) 
    163196     
    164          
     197     
     198    ## @brief Artist all songs view 
     199    #  
     200    #  @param self The object pointer 
     201    #  @param aArtistName Artist name 
    165202    def artistAllSongs(self, aArtistName): 
    166203        print "Audio artist all songs" 
     
    191228         
    192229     
     230    ## @brief Albums view 
     231    #  
     232    #  @param self The object pointer 
    193233    def albums(self): 
    194234        print "Audio album" 
     
    219259     
    220260     
     261    ## @brief Album's songs view 
     262    #  
     263    #  @param self The object pointer 
     264    #  @param aAlbum Album name 
    221265    def albumSongs(self, aAlbum): 
    222266        print "Audio album songs" 
     
    246290        self._iListStack.append(id_list) 
    247291         
    248      
     292         
     293    ## @brief Genres view 
     294    #  
     295    #  @param self The object pointer 
    249296    def genres(self): 
    250297        print "Audio genres" 
     
    277324         
    278325     
     326    ## @brief Genre songs view 
     327    #  
     328    #  @param self The object pointer 
     329    #  @param aGenre Genre name 
    279330    def genreSongs(self, aGenre): 
    280331        print "Audio genres songs" 
     
    305356         
    306357     
     358    ## @brief Playlists view 
     359    #  
     360    #  @param self The object pointer 
    307361    def playlists(self): 
    308362        print "Audio playlists" 
     
    332386     
    333387     
     388    ## @brief Playlist songs view 
     389    #  
     390    #  @param self The object pointer 
     391    #  @param aPlaylist Playlist name 
    334392    def playlistSongs(self, aPlaylist): 
    335393        print "Audio playlist" 
  • mymrc/trunk/mymrc/src/mobileclient/client.py

    r39 r49  
     1## @file mobileclient/client.py 
     2#  @brief Contains the Client class 
     3 
     4## @package mobileclient.client 
     5#  @brief Contains the Client class 
     6 
     7 
    18from mobileclient.clientengine import ClientEngine 
    29from settings.settings import Settings 
     
    815    print aString 
    916 
     17## @brief Client class 
     18# 
    1019class Client: 
     20     
     21    ## @brief The constructor  
     22    # 
     23    #  @param self The object pointer 
     24    #  @param aConnection Connection instance (list) 
    1125    def __init__(self, aConnection ): 
    1226        self._iConn = aConnection[0] 
     
    1933        printd( 'New connection with: ' + str(aConnection[1]) ) 
    2034 
     35     
     36    ## @brief Client observer 
     37    # 
     38    #  @param self The object pointer 
    2139    def _observer(self): 
    2240        # set PID to be able to kill the thread 
     
    3957        printd("Connection closed: " + str( self._iConn ) )         
    4058     
     59     
     60    ## @brief Send a string to the remote client 
     61    # 
     62    #  @param self The object pointer 
     63    #  @param aString String to sned 
    4164    def send(self, aString): 
    4265        print "Send" 
     
    4770            self._iConn.sendall(aString, 512) 
    4871     
     72     
     73    ## @brief Receive 
     74    # 
     75    #  @param self The object pointer 
    4976    def receive(self): 
    5077        pass 
    5178    
     79     
     80    ## @brief Start observer 
     81    # 
     82    #  @param self The object pointer 
    5283    def start_observer(self): 
    5384        print "start_observer(self):" 
    5485        thread.start_new_thread(self._observer, () ) 
    5586     
     87     
     88    ## @brief Stop observer 
     89    # 
     90    #  @param self The object pointer 
    5691    def stop_observer(self): 
    5792        if self._iObserverPid: 
    5893            os.popen("kill -9 "+str(self._iObserverPid)) 
    5994     
     95     
     96    ## @brief The destructor  
     97    # 
     98    #  @param self The object pointer 
    6099    def __del__(self): 
    61100        self._iEngine() 
  • mymrc/trunk/mymrc/src/mobileclient/clientengine.py

    r28 r49  
     1## @file mobileclient/clientengine.py 
     2#  @brief Contains the ClientEngine class 
     3 
     4## @package mobileclient.clientengine 
     5#  @brief Contains the ClientEngine class 
     6 
    17from networking.packet import PacketBuilder 
    28from settings.settings import Settings 
     
    1016    
    1117 
     18## @brief Client engine 
     19# 
    1220class ClientEngine( object ): 
     21 
     22    ## @brief The constructor  
     23    # 
     24    #  @param self The object pointer 
     25    #  @param aSendCb Send function callback 
    1326    def __init__(self, aSendCb): 
    1427        self._iViewEngine = ViewEngine() 
     
    1730        self._iAddToPlaylist = {} 
    1831     
     32     
     33    ## @brief Event handler 
     34    # 
     35    #  @param self The object pointer 
     36    #  @param opcode Operation code 
    1937    def handle_event(self, opcode): 
    2038        print "Event received: ", opcode 
     
    189207            AudioController().hide_show_controls() 
    190208            self.send(PacketBuilder().build(OPCode()['DUMMY'], '')) 
    191              
    192 if __name__ == '__main__': 
    193     Settings('/home/dlefevre/workspace/mymrc/src') 
    194     Lang('/home/dlefevre/workspace/mymrc/src') 
    195     DBDriver( '/home/dlefevre/workspace/mymrc/src' ) 
    196      
    197     query = """SELECT * FROM audio_playlist_data""" 
    198     rs = DBDriver().execute(query) 
    199     print rs.fetchall() 
    200      
    201     query = """SELECT * FROM audio_playlist""" 
    202     rs = DBDriver().execute(query) 
    203     print rs.fetchall() 
    204  
    205     query = """SELECT * FROM audio_song""" 
    206     rs = DBDriver().execute(query) 
    207     print rs.fetchall() 
    208  
    209  
    210     db = AudioQueries() 
    211     rs = db.playlists() 
    212     print rs.fetchall() 
    213      
    214     
    215     def send(aData): 
    216         print aData 
    217      
    218     engine = ClientEngine( send ) 
    219          
    220     while True: 
    221         entry = raw_input('>>>').strip() 
    222         if entry == 'h': 
    223             engine.handle_event(PacketBuilder().build(OPCode()['HELLO'],'')) 
    224         elif entry == 's': 
    225             entry = raw_input('Index >>>').strip() 
    226             engine.handle_event(PacketBuilder().build(OPCode()['SELECT'], entry) ) 
    227         elif entry == 'o': 
    228             entry = raw_input('Index >>>').strip() 
    229             engine.handle_event(PacketBuilder().build(OPCode()['NOWPLAYING'], ''))  
    230         elif entry == 'b': 
    231             engine.handle_event(OPCode()['BACK']) 
    232          
    233          
    234          
    235          
    236         elif entry == 'q': 
    237             break 
    238  
    239     print "Bye bye" 
    240      
    241  
    242      
     209 
     210 
     211#             
     212#if __name__ == '__main__': 
     213#    Settings('/home/dlefevre/workspace/mymrc/src') 
     214#    Lang('/home/dlefevre/workspace/mymrc/src') 
     215#    DBDriver( '/home/dlefevre/workspace/mymrc/src' ) 
     216#     
     217#    query = """SELECT * FROM audio_playlist_data""" 
     218#    rs = DBDriver().execute(query) 
     219#    print rs.fetchall() 
     220#     
     221#    query = """SELECT * FROM audio_playlist""" 
     222#    rs = DBDriver().execute(query) 
     223#    print rs.fetchall() 
     224# 
     225#    query = """SELECT * FROM audio_song""" 
     226#    rs = DBDriver().execute(query) 
     227#    print rs.fetchall() 
     228# 
     229# 
     230#    db = AudioQueries() 
     231#    rs = db.playlists() 
     232#    print rs.fetchall() 
     233#     
     234#    
     235#    def send(aData): 
     236#        print aData 
     237#     
     238#    engine = ClientEngine( send ) 
     239#         
     240#    while True: 
     241#        entry = raw_input('>>>').strip() 
     242#        if entry == 'h': 
     243#            engine.handle_event(PacketBuilder().build(OPCode()['HELLO'],'')) 
     244#        elif entry == 's': 
     245#            entry = raw_input('Index >>>').strip() 
     246#            engine.handle_event(PacketBuilder().build(OPCode()['SELECT'], entry) ) 
     247#        elif entry == 'o': 
     248#            entry = raw_input('Index >>>').strip() 
     249#            engine.handle_event(PacketBuilder().build(OPCode()['NOWPLAYING'], ''))  
     250#        elif entry == 'b': 
     251#            engine.handle_event(OPCode()['BACK']) 
     252#         
     253#         
     254#         
     255#         
     256#        elif entry == 'q': 
     257#            break 
     258# 
     259#    print "Bye bye" 
     260     
     261 
     262     
  • mymrc/trunk/mymrc/src/mobileclient/dvdview.py

    r29 r49  
     1## @file mobileclient/dvdview.py 
     2#  @brief Contains the DvdView class 
     3 
     4## @package mobileclient.dvdview 
     5#  @brief Contains the DvdView class 
    16 
    27 
     8## @brief DVD view class  
     9# 
    310class DvdView(object): 
     11     
     12    ## @brief The constructor  
     13    # 
     14    #  @param self The object pointer 
    415    def __init__(self): 
    516        pass 
    617 
     18 
     19    ## @brief Main view 
     20    # 
     21    #  @param self The object pointer 
    722    def main(self): 
    823        print "Dvd view" 
  • mymrc/trunk/mymrc/src/mobileclient/opcode.py

    r26 r49  
     1## @file mobileclient/opcode.py 
     2#  @brief Contains the OPCode class 
     3 
     4## @package mobileclient.opcode 
     5#  @brief Contains the OPCode class 
    16 
    27 
     8## @brief Operation code dictionary  
     9# 
    310class OPCode( dict ): 
     11     
     12    ## @brief The constructor  
     13    # 
     14    #  @param self The object pointer 
    415    def __init__(self): 
    516        dict.__init__(self) 
  • mymrc/trunk/mymrc/src/mobileclient/tvview.py

    r29 r49  
     1## @file mobileclient/tvview.py 
     2#  @brief Contains the TvView class 
     3 
     4## @package mobileclient.tvview 
     5#  @brief Contains the TvView class 
     6 
     7 
     8## @brief Tv view class 
     9# 
    110class TvView(object): 
     11 
     12    ## @brief The constructor  
     13    # 
     14    #  @param self The object pointer 
    215    def __init__(self): 
    316        pass 
    417     
     18     
     19    ## @brief Main view 
     20    # 
     21    #  @param self The object pointer 
    522    def main(self): 
    623        print "Tv view" 
  • mymrc/trunk/mymrc/src/mobileclient/videoview.py

    r29 r49  
     1## @file mobileclient/videoview.py 
     2#  @brief Contains the VideoView class 
     3 
     4## @package mobileclient.videoview 
     5#  @brief Contains the VideoView class 
     6 
    17from settings.lang import Lang 
    28from mobileclient.appuifw import ListBox 
    39from mobileclient.opcode import OPCode 
    410 
    5 ## Video service view class. 
     11## @brief Video view class 
     12# 
    613class VideoView(object): 
     14     
     15    ## @brief The constructor  
     16    # 
     17    #  @param self The object pointer 
     18    #  @param aViewStack View stack pointer 
     19    #  @param aActionStack Action stack pointer 
     20    #  @param aListStack List stack pointer 
    721    def __init__(self, aViewStack, aActionStack, aListStack): 
    822        self._iViewStack = aViewStack 
     
    1024        self._iListStack = aListStack 
    1125     
     26     
     27    ## @brief Main view 
     28    # 
     29    #  @param self The object pointer 
    1230    def main(self): 
    1331        lb = ListBox(Lang().label('Video')) 
  • mymrc/trunk/mymrc/src/mobileclient/viewengine.py

    r29 r49  
     1## @file mobileclient/viewengine.py 
     2#  @brief Contains the ViewEngine class 
     3 
     4## @package mobileclient.viewengine 
     5#  @brief Contains the ViewEngine class 
     6 
    17from mobileclient.audioview import AudioView 
    28from mobileclient.videoview import VideoView 
  • mymrc/trunk/mymrc/src/mymrc.conf

    r36 r49  
    1212[database] 
    1313dbname=mymrcdb 
    14 path = /home/dlefevre/workspace/mymrc/src 
     14path = /home/mymrc/src 
    1515 
    1616[players] 
  • mymrc/trunk/mymrc/src/mymrcd.py

    r35 r49  
     1## @package mymrcd 
     2#  @brief myMRC daemon 
     3 
     4## @file mymrcd.py 
     5#  @brief myMRC daemon script 
     6 
    17## myMRC deamon 
    28#  @author LEFEVRE Damien 
    39#  @version 0.1 
    4 #  @decription myMRC server daemon 
     10#  @brief myMRC server daemon 
     11 
     12## @package dict 
     13#  @brief dictionary type 
     14 
     15## @class dict 
     16#  @brief dictionary type 
     17 
     18## @package object 
     19#  @brief object type 
     20 
     21## @class object 
     22#  @brief object type 
     23 
     24## @mainpage Welcome to myMRC 0.1  
     25# 
     26#'myMRC' stands for @b my @b Mobile @b Remote @b Control 
     27# 
     28#With myMRC you can remote your multimedia player, DVD, TV... from your PDA or phone via a WiFi or Bluetooth connection. 
     29# 
     30#In its first beta version, we tested the application with MPlayer and totem on Linux environment. MPlayer appears to offer more flexibility and options than totem or other players. To be able to use it you will need to install our mplayerW (mplayer wrapper) which is a client server daemon. For Totem, there's nothing special to do. 
     31# 
     32#  @n 
     33#  @section Configuration 
     34# 
     35#All relevant information are stored in the configuration files: 
     36# 
     37#  @li mymrc.conf 
     38#  @li players.conf 
     39#  @li lang.conf  
     40# 
     41#It is mandatory to set the server IP and port, give the absolute directory path where the database will be stored and the database name. 
     42# 
     43# 
     44#  @n 
     45#  @section library_sec Multimedia Library 
     46#  On the distribution folder there is a Python script for adding songs to the  
     47#  multimedia library @b db_utils.py. Usage 
     48#  
     49#  %\\>python db_utils.py 
     50# 
     51#  Then choose if you want to: 
     52#  @li Add song to database 
     53#  @li Add directory to db 
     54#  @li Add directory to db recursively 
     55# 
     56# As soon as the project will evolve, the remove and edit commands will be added 
     57# 
     58#  @n 
     59#  @section Server 
     60# 
     61#The server has been developed in python, since it was an easy and cross platform solution. Cross platform has its limits, so for now the server will only run on Linux OS. Some modifications will be done later to make it run on Windows. 
     62# 
     63#To start the server, run in its current folder: 
     64# 
     65#%\\>python mymrcd.py 
     66# 
     67#  @n 
     68#  @section Client 
     69# 
     70#In the first beta version, we offer a Java (J2ME) client. In the future you will also have the choice to use a S60 C++ or S60 Python client. 
     71# 
     72#We tested successfully the Java client on: 
     73# 
     74#  @li Nokia N91 
     75#  @li Nokia E61 
     76#  @li Nokia 6234  
     77# 
     78#  @n 
     79#  @section Desktop GUI 
     80# 
     81#A desktop GUI is under development to offer an interface to manage the multimedia library. Written in PyGTK, it would also be a cross platform solution. 
     82# 
     83#  @n   
     84#  @section Future improvement 
     85# 
     86#Some improvements are already programmed: 
     87# 
     88#  @li PyS60 client 
     89#  @li S60 C++ client 
     90#  @li Desktop GUI 
     91#  @li Port on Windows  
     92# 
     93 
     94 
     95 
     96 
    597from settings.settings import Settings 
    698from utils.applock import App_lock 
     
    22114class MyMRCd: 
    23115     
    24     ## The constructor. 
     116    ## @brief The constructor. 
     117    # 
    25118    #  @param self The object pointer.  
    26119    def __init__(self): 
     
    32125         
    33126 
    34     ## Run the server 
     127    ## @brief Run the server 
     128    # 
    35129    #  @param self The object pointer. 
    36130    def run(self): 
     
    38132        BtServer().start() 
    39133 
    40     ## Destructor. Stops the networking servers 
     134    ## @brief Destructor. Stops the networking servers 
     135    # 
    41136    #  @param self The object pointer. 
    42137    def __del__(self): 
     
    46141     
    47142if __name__ == '__main__': 
    48     #APP_LOCK = App_lock() 
     143    ## myMRC deamon instance 
    49144    myMRC = MyMRCd() 
    50145    myMRC.run() 
     
    55150    del myMRC 
    56151    print "Bye bye" 
    57     #APP_LOCK.wait( ) 
  • mymrc/trunk/mymrc/src/networking/__init__.py

    r8 r49  
     1## @package networking 
     2#  @brief errors Package 
     3 
     4## @file networking/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package networking.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/networking/btserver.py

    r34 r49  
     1## @file networking/btserver.py 
     2#  @brief Contains the BtServer and BtServerSocket classes 
     3 
     4## @package networking.btserver 
     5#  @brief Contains the BtServer and BtServerSocket classes 
     6 
     7## @package bluetooth 
     8#  @brief bluetooth package from PyBuez http://org.csail.mit.edu/pybluez/ 
     9 
     10#  Project page: http://org.csail.mit.edu/pybluez/ 
     11 
     12## @class bluetooth 
     13#  @brief bluetooth package from PyBuez  
     14 
     15#  Project page: http://org.csail.mit.edu/pybluez/ 
     16 
     17## @package bluetooth.BluetoothSocket 
     18#  @brief BluetoothSocket class from PyBuez 
     19 
     20#  Project page: http://org.csail.mit.edu/pybluez/ 
     21 
     22## @class bluetooth::BluetoothSocket 
     23#  @brief BluetoothSocket class from PyBuez 
     24 
     25#  Project page: http://org.csail.mit.edu/pybluez/ 
     26 
    127from settings.settings import Settings 
    228import thread, threading, bluetooth 
     
    531def printd( aString ): 
    632    print aString 
     33 
     34 
     35## @brief Bluetooth socket server class  
     36#     
     37class BtServerSocket( bluetooth.BluetoothSocket ): 
    738     
    8 class BtServerSocket( bluetooth.BluetoothSocket ): 
     39    ## @brief The constructor 
     40    #  @param self The object pointer 
     41    #  @param aMac Bluetooth adapter MAC address. By default empty string ("")  
     42    #  and it will detect the default adapter MAC. 
     43    #  @param aPort Port for the service. By detault any 
    944    def __init__(self, aMac="", aPort=bluetooth.PORT_ANY): 
    1045        bluetooth.BluetoothSocket.__init__( self, bluetooth.RFCOMM ) 
     
    2762        printd("Bt interface: %s"%(repr(self.getsockname()))) 
    2863 
    29     ## Add instance to the array. 
    30     #  @param self: The object pointer. 
    31     #  @param aChannel: Channel to had the the array. 
     64    ## @brief Add instance to the array. 
     65    #  @param self The object pointer. 
     66    #  @param aClient Client to had to the array. 
    3267    def _addToStack( self, aClient ): 
    3368        self._iLock.acquire( ) 
     
    3671        printd( "Client added to stack") 
    3772         
    38     ## Handle incomming connection request. 
    39     #  @param self: The object pointer. 
     73    ## @brief Handle incomming connection request. 
     74    #  @param self The object pointer. 
    4075    def _connectionHandler( self ): 
    4176        printd("Wait for incoming connection") 
     
    4883     
    4984         
    50     ## Listen interface for incomming connection. 
     85    ## @brief Listen interface for incomming connection. 
    5186    #  @param self The object pointer. 
    5287    def start( self ): 
    5388        thread.start_new_thread(self._connectionHandler, () )      
    54          
     89      
     90      
     91    ## @brief The destructor 
     92    #  @param self The object pointer.     
    5593    def __del__(self): 
    5694        for client in self._iClientStack: 
     
    5896            del client 
    5997 
    60 ## Bluetooth server singleton. 
     98## @brief Bluetooth server singleton. 
     99# 
    61100class BtServer( object ): 
    62101    ## Stores the unique Singleton instance- 
    63102    _iInstance = None 
    64103     
    65     ## Bluetooth server class declaration 
     104    ## @brief Bluetooth server class declaration 
     105    # 
    66106    class BtServerClass: 
     107         
     108        ## @brief The constructor 
     109        #  @param self The object pointer 
    67110        def __init__( self ): 
    68111            self._iRunning = False 
    69112 
    70113             
    71         ## Start the server. 
     114        ## @brief Start the server. 
    72115        #  @param self The object pointer. 
    73116        def start(self): 
     
    79122            printd("BtServer started") 
    80123         
    81         ## Stop the server. 
     124        ## @brief Stop the server. 
    82125        #  @param self The object pointer. 
    83126        def stop(self): 
     
    86129            printd("BtServer stopped") 
    87130         
    88         ## Restart server. 
     131        ## @brief Restart server. 
    89132        #  @param self The object pointer.     
    90133        def restart(self): 
     
    96139            return self._iRunning 
    97140         
    98     ## The constructor 
     141    ## @brief The constructor 
    99142    #  @param self The object pointer. 
    100143    def __init__( self ): 
     
    108151     
    109152     
    110     ## Delegate access to implementation. 
     153    ## @brief Delegate access to implementation. 
    111154    #  @param self The object pointer. 
    112     #  @param attr Attribute wanted. 
     155    #  @param aAttr Attribute to get. 
    113156    #  @return Attribute 
    114157    def __getattr__(self, aAttr): 
     
    116159  
    117160  
    118     ## Delegate access to implementation. 
     161    ## @brief Delegate access to implementation. 
    119162    #  @param self The object pointer. 
    120     #  @param attr Attribute wanted. 
    121     #  @param value Vaule to be set. 
     163    #  @param aAttr Attribute wanted. 
     164    #  @param aValue Vaule to be set. 
    122165    #  @return Result of operation. 
    123166    def __setattr__(self, aAttr, aValue): 
  • mymrc/trunk/mymrc/src/networking/inetserver.py

    r14 r49  
     1## @file networking/inetserver.py 
     2#  @brief Contains the InetServer and InetServerSocket classes 
     3 
     4## @package networking.inetserver 
     5#  @brief Contains the InetServer and InetServerSocket classes 
     6 
    17################################################################################ 
    28#    Networking:  
     
    1016 
    1117 
    12 # Inet socket server 
     18## @brief Inet socket server 
     19# 
    1320class InetServerSocket( socket.socket ): 
    1421     
    15     ## The constructor. 
     22    ## @brief The constructor. 
    1623    #  @param self: The object pointer. 
    1724    #  @param aHost: Host name to connect to. 
     
    2229        self.bind ( ( str(aHost), int(aPort) ) ) 
    2330        self.listen ( int(aMaxClient) ) 
     31        ## Lock 
    2432        self._iLock = threading.Semaphore() 
     33        ## Client stack 
    2534        self._iClientStack = [] 
     35        ## Maximum connection 
    2636        self._iMaxClient = int(aMaxClient) 
    2737        printd("Inet interface: (%s:%s) - concurrent connection: %s"%(aHost,  
     
    3040 
    3141 
    32     ## Add instance to the array. 
    33     #  @param self: The object pointer. 
    34     #  @param aChannel: Channel to had the the array. 
     42    ## @brief Add instance to the array. 
     43    #  @param self The object pointer. 
     44    #  @param aClient Client to had to the array. 
    3545    def _addToStack( self, aClient ): 
    3646        self._iLock.acquire( ) 
     
    4050         
    4151         
    42     ## Remove instance from array 
     52    ## @brief Remove instance from array 
    4353    #  @param self: The object pointer 
    44     #  @param aChannel: Channel to remove from the queue 
     54    #  @param aClient: Client to remove from the queue 
    4555    def _removeFromStack( self, aClient ): 
    4656        self._iLock.acquire( ) 
     
    5060                     
    5161                     
    52     ## Watch for channel incoming requests. 
     62    ## @brief Watch for channel incoming requests. 
    5363    #  @param self: The object pointer. 
    5464    #  @param aChannel: Channel to remove from the queue. 
     
    6878     
    6979     
    70     ## Handle incomming connection request. 
     80    ## @brief Handle incomming connection request. 
    7181    #  @param self: The object pointer. 
    7282    def _connectionHandler( self ): 
     
    8999     
    90100         
    91     ## Listen interface for incomming connection. 
     101    ## @brief Listen interface for incomming connection. 
    92102    #  @param self The object pointer. 
    93103    def start( self ): 
     
    95105     
    96106         
    97     ## Send data 
     107    ## @brief Send data 
    98108    #  @param self The object pointer. 
    99109    #  @param aFrame Frame.     
     
    101111        pass          
    102112     
     113     
     114    ## @brief The destructor 
     115    #  @param self The object pointer  
    103116    def __del__(self): 
    104117        for client in self._iClientStack: 
     
    106119            del client 
    107120 
    108 ## Inet server singletong 
     121## @brief Inet server singletong 
     122# 
    109123class InetServer( object ):  
    110124    ## Stores the unique Singleton instance- 
    111125    _iInstance = None    
    112126 
    113     ## Inet server class declaration 
     127    ## @brief Inet server class declaration 
     128    # 
    114129    class InetServerClass: 
    115130   
    116         ## The constructor. 
     131        ## @brief The constructor. 
    117132        #  @param self: The object pointer. 
    118133        def __init__( self ): 
    119134            self._iSocketServer = None 
    120135     
    121         ## Start the server. 
     136        ## @brief Start the server. 
    122137        #  @param self The object pointer. 
    123138        def start(self): 
     
    129144            printd("InetServer started") 
    130145         
    131         ## Stop the server. 
     146        ## @brief Stop the server. 
    132147        #  @param self The object pointer. 
    133148        def stop(self): 
     
    137152                printd("InetServer stopped") 
    138153         
    139         ## Restart server. 
     154        ## @brief Restart server. 
    140155        #  @param self The object pointer.     
    141156        def restart(self): 
     
    145160            
    146161        
    147         ## The destructor 
    148         # @param self: The object pointer 
     162        ## @brief The destructor 
     163        #  @param self: The object pointer 
    149164        def __del__( self ): 
    150165            self.stop() 
     
    154169    ########################################################################### 
    155170                 
    156     ## The constructor 
     171    ## @brief The constructor 
    157172    #  @param self The object pointer. 
    158173    def __init__( self ): 
     
    166181     
    167182     
    168     ## Delegate access to implementation. 
     183    ## @brief Delegate access to implementation. 
    169184    #  @param self The object pointer. 
    170     #  @param attr Attribute wanted. 
     185    #  @param aAttr Attribute wanted. 
    171186    #  @return Attribute 
    172187    def __getattr__(self, aAttr): 
     
    174189  
    175190  
    176     ## Delegate access to implementation. 
     191    ## @brief Delegate access to implementation. 
    177192    #  @param self The object pointer. 
    178     #  @param attr Attribute wanted. 
    179     #  @param value Vaule to be set. 
     193    #  @param aAttr Attribute wanted. 
     194    #  @param aValue Vaule to be set. 
    180195    #  @return Result of operation. 
    181196    def __setattr__(self, aAttr, aValue): 
  • mymrc/trunk/mymrc/src/networking/packet.py

    r14 r49  
     1## @file networking/packet.py 
     2#  @brief Contains the Packet, PacketBuilder and PacketParser classes 
     3 
     4## @package networking.packet 
     5#  @brief Contains the Packet, PacketBuilder and PacketParser classes 
     6 
    17""" 
    28Packet format: 
     
    1218from settings.settings import Settings 
    1319 
    14 ## Parse and build packets 
     20## @brief Parse and build packets 
    1521# 
    1622class Packet( object ): 
     
    2026    _iDataLength = 16 
    2127 
     28 
     29    ## @brief The constructor 
     30    #  @param self The object pointer 
    2231    def __init__(self): 
    2332        self._iBufferSize = int(Settings().get("protocol", "BufferSize")) 
    2433        self._iDataLength = int(Settings().get("protocol", "DataLength")) 
    2534     
    26     ## Get the data length with the proper formating (16 characters value). 
     35    ## @brief Get the data length with the proper formating (16 characters value). 
    2736    #  @param self: The object pointer. 
     37    #  @param aData: Data to get the length from 
    2838    #  @return: 16 characters formated length. 
    2939    def _formatedLength( self, aData ): 
     
    3747     
    3848     
    39 ## Packet builder class. 
     49## @brief Packet builder class. 
     50# 
    4051class PacketBuilder( Packet ): 
    41     ## Build a packet to be sent to the client. 
     52    ## @brief Build a packet to be sent to the client. 
    4253    #  @param self: The obkect pointer 
    4354    #  @param aOpCode: Operation code 
     
    5162        return packet 
    5263 
    53 ## Packet parser class. 
     64## @brief Packet parser class. 
     65# 
    5466class PacketParser(Packet): 
    55     ## Parse incoming buffer. 
     67    ## @brief Parse incoming buffer. 
    5668    #  @param self: The object pointer. 
    5769    #  @param aBuffer: buffer coming from the server 
  • mymrc/trunk/mymrc/src/settings/__init__.py

    r8 r49  
     1## @package settings 
     2#  @brief settings Package 
     3 
     4## @file settings/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package settings.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/settings/lang.py

    r14 r49  
     1## @file settings/lang.py 
     2#  @brief Contains the Lang class 
     3 
     4## @package settings.lang 
     5#  @brief Contains the Lang class 
     6 
    17from ConfigParser import ConfigParser 
    28from errors.config import FileMissingError 
     
    511import sys 
    612 
    7 ## Settings class. 
    8 Used to retrieve settings from the configuration file. 
     13## @brief Lang singleton class. 
     14 
    915class Lang( object ): 
    1016    ## Stores the unique Singleton instance- 
    1117    _iInstance = None 
    1218     
    13     ## Players class 
     19    ## @brief Nested class for the singleton 
     20    # 
    1421    class LangClass( ConfigParser ): 
    15         # The constructor. 
     22         
     23        ## @brief The constructor. 
    1624        #  @param self: The object pointer 
     25        #  @param aCwd Directory where the language file is located 
    1726        def __init__( self, aCwd ): 
    1827            ConfigParser.__init__( self ) 
     
    2736            return self.get(Settings().get('settings', 'language'), aLabel) 
    2837                 
    29     ## The constructor 
     38    ## @brief The constructor 
    3039    #  @param self The object pointer. 
     40    #  @param aCwd Directory where the language file is located 
    3141    def __init__( self, aCwd=None ): 
    3242        # Check whether we already have an instance 
     
    3949     
    4050     
    41     ## Delegate access to implementation. 
     51    ## @brief Delegate access to implementation. 
    4252    #  @param self The object pointer. 
    43     #  @param attr Attribute wanted. 
     53    #  @param aAttr Attribute wanted. 
    4454    #  @return Attribute 
    4555    def __getattr__(self, aAttr): 
     
    4757  
    4858  
    49     ## Delegate access to implementation. 
     59    ## @brief Delegate access to implementation. 
    5060    #  @param self The object pointer. 
    51     #  @param attr Attribute wanted. 
    52     #  @param value Vaule to be set. 
     61    #  @param aAttr Attribute wanted. 
     62    #  @param aValue Vaule to be set. 
    5363    #  @return Result of operation. 
    5464    def __setattr__(self, aAttr, aValue): 
  • mymrc/trunk/mymrc/src/settings/players.py

    r8 r49  
     1## @file settings/players.py 
     2#  @brief Contains the Players class 
     3 
     4## @package settings.players 
     5#  @brief Contains the Players class 
     6 
    17from ConfigParser import ConfigParser 
    28from errors.config import FileMissingError 
     
    410import sys 
    511 
    6 ## Settings class. 
    7 Used to retrieve settings from the configuration file. 
     12## @brief Players singleton class 
     13 
    814class Players( object ): 
    915    ## Stores the unique Singleton instance- 
    1016    _iInstance = None 
    1117     
    12     ## Players class 
     18    ## @brief Nested class for the Players singleton 
     19    # 
    1320    class PlayersClass( ConfigParser ): 
    14         # The constructor. 
     21         
     22        ## @brief  The constructor. 
    1523        #  @param self: The object pointer 
     24        #  @param aCwd Directory where the player configuration file is located         
    1625        def __init__( self, aCwd ): 
    1726            ConfigParser.__init__( self ) 
     
    2231                sys.exit(1) 
    2332                 
    24     ## The constructor 
     33    ## @brief The constructor 
    2534    #  @param self The object pointer. 
     35    #  @param aCwd Directory where the player configuration file is located 
    2636    def __init__( self, aCwd=None ): 
    2737        # Check whether we already have an instance 
     
    3444     
    3545     
    36     ## Delegate access to implementation. 
     46    ## @brief Delegate access to implementation. 
    3747    #  @param self The object pointer. 
    38     #  @param attr Attribute wanted. 
     48    #  @param aAttr Attribute wanted. 
    3949    #  @return Attribute 
    4050    def __getattr__(self, aAttr): 
     
    4252  
    4353  
    44     ## Delegate access to implementation. 
     54    ## @brief Delegate access to implementation. 
    4555    #  @param self The object pointer. 
    46     #  @param attr Attribute wanted. 
    47     #  @param value Vaule to be set. 
     56    #  @param aAttr Attribute wanted. 
     57    #  @param aValue Vaule to be set. 
    4858    #  @return Result of operation. 
    4959    def __setattr__(self, aAttr, aValue): 
  • mymrc/trunk/mymrc/src/settings/settings.py

    r8 r49  
     1## @file settings/settings.py 
     2#  @brief Contains the Settings Singleton class 
     3 
     4## @package settings.settings 
     5#  @brief Contains the Settings Singleton class 
     6 
    17from ConfigParser import ConfigParser 
    28from errors.config import FileMissingError, DatabaseSectionError 
     
    511 
    612 
    7 ## Settings class. 
     13## @brief Settings class. 
    814#  Used to retrieve settings from the configuration file. 
    915class Settings( object ): 
     
    1117    _iInstance = None 
    1218         
     19         
     20    ## @brief Nested class for the Settings singleton. 
     21    # 
    1322    class SettingsClass( ConfigParser ): 
    1423        # The constructor. 
    1524        #  @param self: The object pointer 
     25        #  @param aCwd Directory where the settings configuration file is located 
    1626        def __init__( self, aCwd ): 
    1727            ConfigParser.__init__( self ) 
     
    3040    ## The constructor 
    3141    #  @param self The object pointer. 
     42    #  @param aCwd Directory where the settings configuration file is located 
    3243    def __init__( self, aCwd=None ): 
    3344        # Check whether we already have an instance 
     
    4253    ## Delegate access to implementation. 
    4354    #  @param self The object pointer. 
    44     #  @param attr Attribute wanted. 
     55    #  @param aAttr Attribute wanted. 
    4556    #  @return Attribute 
    4657    def __getattr__(self, aAttr): 
     
    5061    ## Delegate access to implementation. 
    5162    #  @param self The object pointer. 
    52     #  @param attr Attribute wanted. 
    53     #  @param value Vaule to be set. 
     63    #  @param aAttr Attribute wanted. 
     64    #  @param aValue Vaule to be set. 
    5465    #  @return Result of operation. 
    5566    def __setattr__(self, aAttr, aValue): 
  • mymrc/trunk/mymrc/src/utils/__init__.py

    r8 r49  
     1## @package utils 
     2#  @brief utils Package 
     3 
     4## @file utils/__init__.py 
     5#  @brief Package module and/or package loader. 
     6 
     7## @package utils.__init__ 
     8#  @brief Package module and/or package loader 
  • mymrc/trunk/mymrc/src/utils/applock.py

    r8 r49  
     1## @file utils/applock.py 
     2#  @brief Contains the App Lock class 
     3 
     4## @package utils.applock 
     5#  @brief Contains the App Lock class 
     6 
    17import threading 
    28## Application lock.