Changeset 3439 for pykoticon

Show
Ignore:
Timestamp:
10/06/08 00:29:29 (16 years ago)
Author:
jerome
Message:

Removed trailing spaces.

Location:
pykoticon/trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r180 r3439  
    11#! /usr/bin/env python 
    2 # -*- coding: ISO-8859-15 -*- 
     2# -*- coding: iso-8859-15 -*- 
    33 
    44"""PyKotIcon is a generic, networked, cross-platform dialog box manager.""" 
     
    1616# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1717# GNU General Public License for more details. 
    18 #  
     18# 
    1919# You should have received a copy of the GNU General Public License 
    2020# along with this program; if not, write to the Free Software 
     
    4545try : 
    4646    import optparse 
    47 except ImportError :     
     47except ImportError : 
    4848    sys.stderr.write("You need Python v2.3 or higher for PyKotIcon to work.\nAborted.\n") 
    4949    sys.exit(-1) 
     
    5353    try : 
    5454        import win32api 
    55     except ImportError :     
     55    except ImportError : 
    5656        raise ImportError, "Mark Hammond's Win32 Extensions are missing. Please install them." 
    57     else :     
     57    else : 
    5858        iconsdir = os.path.split(sys.argv[0])[0] 
    59 else :         
     59else : 
    6060    isWindows = False 
    6161    iconsdir = "/usr/share/pykoticon"   # TODO : change this 
    6262    import pwd 
    63      
    64 try :     
     63 
     64try : 
    6565    import wx 
    6666    hasWxPython = True 
    67 except ImportError :     
     67except ImportError : 
    6868    hasWxPython = False 
    6969    raise ImportError, "wxPython is missing. Please install it." 
    70      
     70 
    7171aboutbox = """PyKotIcon v%(__version__)s (c) 2003-2006 %(__author__)s - %(__author_email__)s 
    7272 
     
    9898        try : 
    9999            SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self) 
    100         except TypeError :     
     100        except TypeError : 
    101101            SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, False, None) 
    102102        SocketServer.ThreadingTCPServer.__init__(self, addr, requestHandler) 
    103          
     103 
    104104class MyXMLRPCServer(ThreadedXMLRPCServer) : 
    105105    """My own server class.""" 
     
    119119        loop = threading.Thread(target=self.mainloop) 
    120120        loop.start() 
    121          
    122     def logDebug(self, message) :     
     121 
     122    def logDebug(self, message) : 
    123123        """Logs a debug message if debug mode is active.""" 
    124124        if self.debug : 
    125125            sys.stderr.write("%s\n" % message) 
    126              
     126 
    127127    def getAnswerFromCache(self, key) : 
    128128        """Tries to extract a value from the cache and returns it if still valid.""" 
    129129        cacheentry = self.cache.get(key) 
    130130        if cacheentry is not None : 
    131             (birth, value) = cacheentry  
     131            (birth, value) = cacheentry 
    132132            if (time.time() - birth) < self.cacheduration : 
    133133                self.logDebug("Cache hit for %s" % str(key)) 
    134134                return value # NB : we don't extend the life of this entry 
    135             else :     
     135            else : 
    136136                self.logDebug("Cache expired for %s" % str(key)) 
    137         else :         
     137        else : 
    138138            self.logDebug("Cache miss for %s" % str(key)) 
    139139        return None 
    140          
    141     def storeAnswerInCache(self, key, value) :     
     140 
     141    def storeAnswerInCache(self, key, value) : 
    142142        """Stores an entry in the cache.""" 
    143143        self.cache[key] = (time.time(), value) 
    144144        self.logDebug("Cache store for %s" % str(key)) 
    145          
     145 
    146146    def export_askDatas(self, labels, varnames, varvalues) : 
    147147        """Asks some textual datas defined by a list of labels, a list of variables' names and a list of variables values in a mapping.""" 
     
    149149        for (key, value) in varvalues.items() : 
    150150            values[key] = self.frame.UTF8ToUserCharset(value.data) 
    151         cachekey = tuple(values.items())   
     151        cachekey = tuple(values.items()) 
    152152        retcode = self.getAnswerFromCache(cachekey) 
    153153        if (retcode is None) or (not retcode["isValid"]) : 
     
    158158            while self.frame.dialogAnswer is None : 
    159159                time.sleep(0.1) 
    160             retcode = self.frame.dialogAnswer     
     160            retcode = self.frame.dialogAnswer 
    161161            for (key, value) in retcode.items() : 
    162162                if key != "isValid" : 
     
    165165            self.storeAnswerInCache(cachekey, retcode) 
    166166        return retcode 
    167          
    168     def export_quitApplication(self) :     
     167 
     168    def export_quitApplication(self) : 
    169169        """Makes the application quit.""" 
    170170        self.frame.quitEvent.set() 
    171171        wx.CallAfter(self.frame.OnClose, None) 
    172172        return True 
    173          
     173 
    174174    def export_showDialog(self, message, yesno) : 
    175175        """Opens a notification or confirmation dialog.""" 
     
    178178        while self.frame.dialogAnswer is None : 
    179179            time.sleep(0.1) 
    180         retcode = self.frame.dialogAnswer     
     180        retcode = self.frame.dialogAnswer 
    181181        self.frame.dialogAnswer = None # prepare for next call, just in case 
    182182        return retcode 
    183          
    184     def export_nop(self) :     
     183 
     184    def export_nop(self) : 
    185185        """Does nothing, but allows a clean shutdown from the frame itself.""" 
    186186        return True 
    187          
    188     def _dispatch(self, method, params) :     
     187 
     188    def _dispatch(self, method, params) : 
    189189        """Ensure that only export_* methods are available.""" 
    190190        return getattr(self, "export_%s" % method)(*params) 
    191          
    192     def handle_error(self, request, client_address) :     
     191 
     192    def handle_error(self, request, client_address) : 
    193193        """Doesn't display an ugly traceback in case an error occurs.""" 
    194194        self.logDebug("An exception occured while handling an incoming request from %s:%s" % (client_address[0], client_address[1])) 
    195          
     195 
    196196    def verify_request(self, request, client_address) : 
    197197        """Ensures that requests which don't come from the print server are rejected.""" 
     
    204204            self.logDebug("%s rejected." % client) 
    205205            return False 
    206          
     206 
    207207    def mainloop(self) : 
    208208        """XML-RPC Server's main loop.""" 
     
    213213        while not self.frame.quitEvent.isSet() : 
    214214            self.handle_request() 
    215         self.server_close()     
     215        self.server_close() 
    216216        sys.exit(0) 
    217      
    218      
     217 
     218 
    219219class GenericInputDialog(wx.Dialog) : 
    220220    """Generic input dialog box.""" 
     
    233233            try : 
    234234                label = labels[i] 
    235             except IndexError :     
     235            except IndexError : 
    236236                label = "" 
    237             labelid = wx.NewId()     
     237            labelid = wx.NewId() 
    238238            varid = wx.NewId() 
    239239            labelst = wx.StaticText(self, labelid, label) 
     
    242242            else : 
    243243                variable = wx.TextCtrl(self, varid, varvalues.get(varname, "")) 
    244             self.variables.append(variable)     
     244            self.variables.append(variable) 
    245245            hsizer = wx.BoxSizer(wx.HORIZONTAL) 
    246246            hsizer.Add(labelst, 0, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL, 5) 
    247247            hsizer.Add(variable, 0, wx.ALIGN_CENTER | wx.ALIGN_LEFT | wx.ALL, 5) 
    248248            vsizer.Add(hsizer, 0, wx.ALIGN_CENTER | wx.ALL, 5) 
    249              
    250         okbutton = wx.Button(self, wx.ID_OK, "OK")     
     249 
     250        okbutton = wx.Button(self, wx.ID_OK, "OK") 
    251251        vsizer.Add(okbutton, 0, wx.ALIGN_CENTER | wx.ALL, 5) 
    252252        if self.variables : 
     
    255255        self.SetSizerAndFit(vsizer) 
    256256        self.Layout() 
    257          
    258          
     257 
     258 
    259259class PyKotIcon(wx.Frame): 
    260260    """Main class.""" 
     
    265265               size = (0, 0), \ 
    266266               style = wx.FRAME_NO_TASKBAR | wx.NO_FULL_REPAINT_ON_RESIZE) 
    267                       
     267 
    268268    def getCurrentUserName(self) : 
    269269        """Retrieves the current user's name.""" 
     
    271271            if isWindows : 
    272272                return win32api.GetUserName() 
    273             else :     
     273            else : 
    274274                return pwd.getpwuid(os.geteuid())[0] 
    275275        except : 
    276276            return "** Unknown **" 
    277              
     277 
    278278    def OnIconify(self, event) : 
    279279        """Iconify/De-iconify the application.""" 
     
    299299            self.Destroy() 
    300300            return True 
    301         else :     
     301        else : 
    302302            # self.quitIsForbidden() 
    303303            return False 
     
    310310        """React to close from the taskbar.""" 
    311311        self.Close() 
    312              
    313     def quitIsForbidden(self) :         
     312 
     313    def quitIsForbidden(self) : 
    314314        """Displays a message indicating that quitting the application is not allowed.""" 
    315315        message = _("Sorry, this was forbidden by your system administrator.") 
     
    319319        dialog.ShowModal() 
    320320        dialog.Destroy() 
    321          
    322     def OnAbout(self, event) :     
     321 
     322    def OnAbout(self, event) : 
    323323        """Displays the about box.""" 
    324324        dialog = wx.MessageDialog(self, aboutbox % globals(), \ 
    325325                                        _("About"), \ 
    326326                                        wx.OK | wx.ICON_INFORMATION) 
    327         dialog.Raise()                                         
     327        dialog.Raise() 
    328328        dialog.ShowModal() 
    329329        dialog.Destroy() 
    330          
     330 
    331331    def showDialog(self, message, yesno) : 
    332332        """Opens a notification dialog.""" 
     
    338338            caption = _("Information") 
    339339            style = wx.OK | wx.ICON_INFORMATION 
    340         style |= wx.STAY_ON_TOP     
     340        style |= wx.STAY_ON_TOP 
    341341        dialog = wx.MessageDialog(self, message, caption, style) 
    342342        dialog.Raise() 
    343343        self.dialogAnswer = ((dialog.ShowModal() == wx.ID_NO) and "CANCEL") or "OK" 
    344344        dialog.Destroy() 
    345          
     345 
    346346    def askDatas(self, labels, varnames, varvalues) : 
    347347        """Opens a dialog box asking for data entry.""" 
     
    354354            for i in range(len(varnames)) : 
    355355                retvalues[varnames[i]] = dialog.variables[i].GetValue() 
    356         else :         
     356        else : 
    357357            retvalues["isValid"] = False 
    358358            for k in varvalues.keys() : 
     
    360360        self.dialogAnswer = retvalues 
    361361        dialog.Destroy() 
    362          
    363     def closeServer(self) :     
     362 
     363    def closeServer(self) : 
    364364        """Tells the xml-rpc server to exit.""" 
    365365        if not self.quitEvent.isSet() : 
    366366            self.quitEvent.set() 
    367         server = xmlrpclib.ServerProxy("http://localhost:%s" % self.options.port)     
     367        server = xmlrpclib.ServerProxy("http://localhost:%s" % self.options.port) 
    368368        try : 
    369             # wake the server with an empty request  
     369            # wake the server with an empty request 
    370370            # for it to see the event object 
    371371            # which has just been set 
    372372            server.nop() 
    373         except :     
     373        except : 
    374374            # Probably already stopped 
    375375            pass 
    376          
    377     def postInit(self, charset, options, arguments) :     
     376 
     377    def postInit(self, charset, options, arguments) : 
    378378        """Starts the XML-RPC server.""" 
    379379        self.charset = charset 
    380380        self.options = options 
    381          
     381 
    382382        self.tbicon = wx.TaskBarIcon() 
    383383        self.greenicon = wx.Icon(os.path.join(iconsdir, "pykoticon-green.ico"), \ 
     
    386386                                  wx.BITMAP_TYPE_ICO) 
    387387        self.tbicon.SetIcon(self.greenicon, "PyKotIcon") 
    388          
     388 
    389389        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate) 
    390390        wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu) 
    391          
     391 
    392392        self.TBMENU_ABOUT = wx.NewId() 
    393393        self.TBMENU_RESTORE = wx.NewId() 
     
    408408        self.Show(True) 
    409409        self.Hide() 
    410          
     410 
    411411        self.quitEvent = threading.Event() 
    412412        self.server = MyXMLRPCServer(self, options, arguments) 
    413          
     413 
    414414    def UTF8ToUserCharset(self, text) : 
    415415        """Converts from UTF-8 to user's charset.""" 
    416416        if text is not None : 
    417417            try : 
    418                 return text.decode("UTF-8").encode(self.charset, "replace")  
    419             except (UnicodeError, AttributeError) :     
     418                return text.decode("UTF-8").encode(self.charset, "replace") 
     419            except (UnicodeError, AttributeError) : 
    420420                try : 
    421421                    # Maybe already in Unicode 
    422                     return text.encode(self.charset, "replace")  
     422                    return text.encode(self.charset, "replace") 
    423423                except (UnicodeError, AttributeError) : 
    424424                    pass # Don't know what to do 
    425425        return text 
    426          
     426 
    427427    def userCharsetToUTF8(self, text) : 
    428428        """Converts from user's charset to UTF-8.""" 
     
    432432            except (UnicodeError, AttributeError) : 
    433433                try : 
    434                     return text.decode(self.charset, "replace").encode("UTF-8")  
    435                 except (UnicodeError, AttributeError) :     
     434                    return text.decode(self.charset, "replace").encode("UTF-8") 
     435                except (UnicodeError, AttributeError) : 
    436436                    try : 
    437437                        # Maybe already in Unicode 
    438                         return text.encode("UTF-8", "replace")  
     438                        return text.encode("UTF-8", "replace") 
    439439                    except (UnicodeError, AttributeError) : 
    440440                        pass # Don't know what to do 
    441441        return text 
    442          
     442 
    443443 
    444444class PyKotIconApp(wx.App): 
     
    448448        self.SetTopWindow(self.frame) 
    449449        return True 
    450          
    451     def postInit(self, charset, options, arguments) :     
     450 
     451    def postInit(self, charset, options, arguments) : 
    452452        """Continues processing.""" 
    453453        self.frame.postInit(charset, options, arguments) 
    454          
    455          
     454 
     455 
    456456def main() : 
    457457    """Program's entry point.""" 
     
    464464    language = language or "C" 
    465465    charset = ((sys.platform != "win32") and charset) or locale.getpreferredencoding() 
    466      
     466 
    467467    # translation stuff 
    468468    try : 
     
    474474    except : 
    475475        gettext.NullTranslations().install() 
    476      
    477      
     476 
     477 
    478478    parser = optparse.OptionParser(usage="pykoticon [options] server1 [server2 ...]") 
    479     parser.add_option("-v", "--version",  
    480                             action="store_true",  
     479    parser.add_option("-v", "--version", 
     480                            action="store_true", 
    481481                            dest="version", 
    482482                            help=_("show PyKotIcon's version number and exit.")) 
    483     parser.add_option("-c", "--cache",  
    484                             type="int",  
    485                             default=0,  
     483    parser.add_option("-c", "--cache", 
     484                            type="int", 
     485                            default=0, 
    486486                            dest="cache", 
    487487                            help=_("the duration of the cache in seconds to keep input forms' datas in memory. Defaults to 0 second, meaning no cache.")) 
    488     parser.add_option("-d", "--debug",  
    489                             action="store_true",  
     488    parser.add_option("-d", "--debug", 
     489                            action="store_true", 
    490490                            dest="debug", 
    491491                            help=_("activate debug mode.")) 
    492     parser.add_option("-p", "--port",  
    493                             type="int",  
    494                             default=7654,  
     492    parser.add_option("-p", "--port", 
     493                            type="int", 
     494                            default=7654, 
    495495                            dest="port", 
    496496                            help=_("the TCP port PyKotIcon will listen to, default is 7654.")) 
    497     parser.add_option("-q", "--allowquit",  
    498                             action="store_true",  
     497    parser.add_option("-q", "--allowquit", 
     498                            action="store_true", 
    499499                            dest="allowquit", 
    500500                            help=_("allow the end user to close the application.")) 
     
    505505        if not (1024 <= options.port <= 65535) : 
    506506            sys.stderr.write(_("The TCP port number specified for --port must be between 1024 and 65535.\n")) 
    507         elif not (0 <= options.cache <= 86400) :     
     507        elif not (0 <= options.cache <= 86400) : 
    508508            sys.stderr.write(_("The duration specified for --cache must be between 0 and 86400 seconds.\n")) 
    509         else :     
     509        else : 
    510510            app = PyKotIconApp() 
    511511            app.postInit(charset, options, arguments) 
    512512            app.MainLoop() 
    513      
    514      
     513 
     514 
    515515if __name__ == '__main__': 
    516516    main() 
    517      
     517 
  • pykoticon/trunk/clean.sh

    r141 r3439  
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program; if not, write to the Free Software 
  • pykoticon/trunk/CREDITS

    r180 r3439  
    2222    - Georger Araujo : Fixed a charset encoding problem under MS-Windows. 
    2323    - Rodolfo Cossalter : Fixed a problem under MS-Windows 98/Me. 
    24      
     24 
  • pykoticon/trunk/man/genman.sh

    r176 r3439  
    1414# $Id$ 
    1515# 
    16 for prog in pykoticon ; do  
     16for prog in pykoticon ; do 
    1717    echo $prog ; 
    18     help2man --no-info --section=1 --manual "User Commands" --source="C@LL - Conseil Internet & Logiciels Libres" --output=$prog.1 $prog ;  
     18    help2man --no-info --section=1 --manual "User Commands" --source="C@LL - Conseil Internet & Logiciels Libres" --output=$prog.1 $prog ; 
    1919    echo ; 
    2020done 
  • pykoticon/trunk/NEWS

    r177 r3439  
    2323 
    2424  - 1.03 (2007-01-26) : 
    25      
     25 
    2626    - Can now accept several requests concurrently, which may 
    2727      help with terminal servers. 
    28        
     28 
    2929    - Fixed a focus problem. 
    30      
     30 
    3131    - Rewrote the tests/test.py program to give a better 
    3232      experience to testers. 
    33        
     33 
    3434  - 1.02 (2006-06-07) : 
    35      
     35 
    3636    - Added the --cache command line option to specify the time in 
    3737      seconds during which input forms' content will be cached. 
    3838      This allows people to avoid retyping their username and 
    3939      password for each print job, for example. 
    40        
     40 
    4141    - Doesn't display the Quit menu anymore if not allowed. 
    42      
    43     - Doesn't display the ugly traceback anymore when the client   
     42 
     43    - Doesn't display the ugly traceback anymore when the client 
    4444      disconnects before the server has sent the answer back 
    4545      (pknotify --timeout). 
    46        
     46 
    4747  - 1.01 (2006-05-01) : 
    48        
    49     - Now accepts command line options.     
    50      
     48 
     49    - Now accepts command line options. 
     50 
    5151    - Less ugly when run under *nix. 
    52      
     52 
    5353    - Debug mode off by default. 
    54      
    55   - 1.00 (2006-03-23) :  
    56    
     54 
     55  - 1.00 (2006-03-23) : 
     56 
    5757    - First release 
  • pykoticon/trunk/README

    r176 r3439  
    2222PyKotIcon is a cross-platform client-side helper for PyKota. 
    2323 
    24 It is meant to be launched whenever the user logs in, and stay in  
    25 the taskbar (depending on the client operating system) until the  
    26 user closes his session.  
    27    
     24It is meant to be launched whenever the user logs in, and stay in 
     25the taskbar (depending on the client operating system) until the 
     26user closes his session. 
     27 
    2828Installation : 
    2929 
    3030  * GNU/Linux and similar : 
    31    
     31 
    3232    $ cd pykoticon 
    3333    $ python setup.py install 
    34      
     34 
    3535    Then modify your .xsession file, or the appropriate file depending 
    3636    on your desktop environment, to ensure that the pykoticon command 
    3737    is launched in the background each time your X Window session 
    3838    starts. 
    39      
     39 
    4040    You MUST pass the list of hostnames or IP addresses from which 
    4141    PyKotIcon should accept incoming connexions on pykoticon's 
     
    4444    hostnames or IP addresses of ALL print servers on pykoticon's 
    4545    command line. 
    46      
     46 
    4747    NB : `pykoticon --help` will give you hints about the expected 
    4848    command line parameters. 
    49      
    50   * MS Windows :   
    51    
    52     Download pykoticon-x.yy.zip from  
    53      
     49 
     50  * MS Windows : 
     51 
     52    Download pykoticon-x.yy.zip from 
     53 
    5454        http://www.pykota.com/software/pykoticon/download/tarballs/ 
    55          
    56     Unzip it into a directory of its own. I usually unzip it into     
     55 
     56    Unzip it into a directory of its own. I usually unzip it into 
    5757    /var/lib/samba/netlogon/pykoticon/ 
    58      
     58 
    5959    Modify the PYKOTICON.VBS file to include the list of authorized 
    6060    print servers and change other parameters as needed, as explained 
    6161    in the GNU/Linux section above. 
    62      
     62 
    6363    Ensure that PYKOTICON.VBS is executed each time an user logs 
    6464    in. The easiest way to do this is in STARTUP.CMD : 
    65      
     65 
    6666      --- CUT --- 
    6767      SET PATH=%PATH%;\\MYSERVER\NETLOGON\PYKOTICON\ 
    68       \\MYSERVER\NETLOGON\PYKOTICON\PYKOTICON.VBS  
     68      \\MYSERVER\NETLOGON\PYKOTICON\PYKOTICON.VBS 
    6969      --- CUT --- 
    70        
     70 
    7171    NB : if you launch PYKOTICON.EXE directly instead of from 
    72     PYKOTICON.VBS, a small but disturbing window may appear on  
     72    PYKOTICON.VBS, a small but disturbing window may appear on 
    7373    the screen. 
    7474 
     
    8484  independant of PyKota, and can be used from any application 
    8585  which can do remote procedure calls over XML-RPC. 
    86    
     86 
    8787  PyKotIcon exposes 4 of its methods over XML-RPC, here they are : 
    88    
     88 
    8989    - nop : 
    90      
     90 
    9191      This methods does exactly nothing :) 
    92        
     92 
    9393      - Input : No argument. 
    94        
     94 
    9595      - Output : returns the True boolean value. 
    96        
    97     - quitApplication :   
    98      
     96 
     97    - quitApplication : 
     98 
    9999      This method causes the PyKotIcon application to exit. 
    100        
     100 
    101101      - Input : No argument. 
    102        
     102 
    103103      - Output : returns the True boolean value. 
    104            
    105     - showDialog :   
    106     
     104 
     105    - showDialog : 
     106 
    107107      This methods displays an informational message, and returns 
    108108      the choice the user made, if any. 
    109         
    110       - Input :  
    111          
    112         - message : a Binary XML-RPC object representing an UTF-8 encoded  
    113           character string which will be displayed to the end user.  
    114           This string can contain literal "\n" sequences which will  
     109 
     110      - Input : 
     111 
     112        - message : a Binary XML-RPC object representing an UTF-8 encoded 
     113          character string which will be displayed to the end user. 
     114          This string can contain literal "\n" sequences which will 
    115115          be automatically expanded into line breaks by PyKotIcon. 
    116            
    117         - confirmation : a boolean value indicating if the user will   
     116 
     117        - confirmation : a boolean value indicating if the user will 
    118118          be given the choice to valid or cancel (True), or only 
    119119          to valid (False) the dialog box. 
    120              
    121       - Output :       
    122        
     120 
     121      - Output : 
     122 
    123123        - the literal string "OK" if the user clicked on the OK button, 
    124124          else the literal string "CANCEL". The latter is only possible 
    125125          if the method was called with its second parameter set to 
    126126          True. 
    127          
    128     - askDatas :       
    129      
     127 
     128    - askDatas : 
     129 
    130130      This method can generate an input form and return what the user 
    131131      entered in the different fields. 
    132        
     132 
    133133      - Input : 
    134        
    135         - An array of labels, one label per input field in the  
     134 
     135        - An array of labels, one label per input field in the 
    136136          form to be created. Each label in the list is passed as 
    137137          a Binary XML-RPC object representing an UTF-8 encoded 
    138138          character string. 
    139            
     139 
    140140        - An array of variables names, one name per input field in 
    141141          the form to be created. Each name in the list is passed 
    142           as an ASCII encoded character string.  
     142          as an ASCII encoded character string. 
    143143          IMPORTANT : if one of these names is 'password' then this 
    144           particular field's input box will be visually protected  
     144          particular field's input box will be visually protected 
    145145          with * in place of the characters typed during input. 
    146            
    147         - An associative array (e.g. Python mapping) of initial values.  
     146 
     147        - An associative array (e.g. Python mapping) of initial values. 
    148148          Each key is a variable name which must be present in the list 
    149149          above, and each value is a possibly empty initial content, 
    150           which will be passed as a Binary XML-RPC object representing  
     150          which will be passed as a Binary XML-RPC object representing 
    151151          an UTF-8 encoded character string. 
    152        
     152 
    153153      - Output : 
    154        
     154 
    155155        - An associative array (e.g. Python mapping) containing the 
    156156          variables names as keys and the variables' contents as 
    157157          values in the following format : 
    158            
     158 
    159159          - Each key is an ASCII encoded character string representing 
    160             the name of a variable to ask which was passed from the  
     160            the name of a variable to ask which was passed from the 
    161161            caller. 
    162              
    163           - Each value is a Binary XML-RPC object representing an UTF-8   
     162 
     163          - Each value is a Binary XML-RPC object representing an UTF-8 
    164164            encoded character string, itself being the result of user 
    165165            input in the form's field for this particular variable. 
     
    173173            In this case, all the other values are empty strings 
    174174            anyway. 
    175              
    176              
    177 IMPORTANT : PyKotIcon doesn't currently support encrypted connexions,             
     175 
     176 
     177IMPORTANT : PyKotIcon doesn't currently support encrypted connexions, 
    178178so if you're afraid of sensitive information flying in the clear 
    179 over the nework, you should probably install a transparent secure  
     179over the nework, you should probably install a transparent secure 
    180180tunneling software like stunnel on both sides of each connection. 
    181181 
    182182==================================================================== 
    183      
     183 
    184184Please e-mail bugs to the PyKota mailing list at : pykota@librelogiciel.com 
    185185or to the main author at : alet@librelogiciel.com (Jerome Alet) 
  • pykoticon/trunk/setup.py

    r176 r3439  
    11#! /usr/bin/env python 
    2 # -*- coding: ISO-8859-15 -*- 
     2# -*- coding: iso-8859-15 -*- 
    33 
    44"""Packaging and installation script for PyKotIcon.""" 
     
    1616# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1717# GNU General Public License for more details. 
    18 #  
     18# 
    1919# You should have received a copy of the GNU General Public License 
    2020# along with this program; if not, write to the Free Software 
     
    3636        sys.stderr.write("py2exe is not installed ! ABORTING.\n") 
    3737        sys.exit(-1) 
    38     else :     
     38    else : 
    3939        directory = os.sep.join(["share", "pykoticon"]) 
    4040        mandir = os.sep.join(["share", "man", "man1"]) 
    41         manpages = glob.glob(os.sep.join(["man", "*.1"]))     
     41        manpages = glob.glob(os.sep.join(["man", "*.1"])) 
    4242        initialdatafiles = [(mandir, manpages)] 
    4343        withPy2EXE = False 
    44 else :         
     44else : 
    4545    directory = "." 
    4646    initialdatafiles = [] 
     
    4848 
    4949config = imp.load_source("config", os.path.join("bin", "pykoticon")) 
    50 setupDictionary = { "name" : "pykoticon",  
     50setupDictionary = { "name" : "pykoticon", 
    5151                    "version" : config.__version__, 
    5252                    "license" : config.__license__, 
  • pykoticon/trunk/tests/test.py

    r176 r3439  
    11#! /usr/bin/env python 
    2 # -*- coding: ISO-8859-15 -*- 
     2# -*- coding: iso-8859-15 -*- 
    33 
    44# PyKotIcon - Client side helper for PyKota and other applications 
     
    1414# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1515# GNU General Public License for more details. 
    16 #  
     16# 
    1717# You should have received a copy of the GNU General Public License 
    1818# along with this program; if not, write to the Free Software 
     
    4343    # Opens the connection to the PyKotIcon server : 
    4444    server = xmlrpclib.ServerProxy("http://%s:%s" % (arguments[0], arguments[1])) 
    45      
     45 
    4646    # Now display something on the PyKotIcon host : 
    4747    message1 = "You are about to test PyKotIcon\n\nPyKotIcon is really great software !" 
    4848    server.showDialog(xmlrpclib.Binary(message1.encode("UTF-8")), False) 
    49      
    50     # Now ask the end user if he really wants to do this :  
     49 
     50    # Now ask the end user if he really wants to do this : 
    5151    message2 = "Are you sure you want to do this ?" 
    5252    result = server.showDialog(xmlrpclib.Binary(message2.encode("UTF-8")), True) 
    5353    print "The remote user said : %s" % result 
    54      
     54 
    5555    # Displays the answer back : 
    5656    answer = "You have clicked on the %s button" % result 
    5757    server.showDialog(xmlrpclib.Binary(answer.encode("UTF-8")), False) 
    58      
    59     # Now we will ask some datas :  
     58 
     59    # Now we will ask some datas : 
    6060    result = server.askDatas([xmlrpclib.Binary(v) for v in ["Username", "Password", "Country"]], \ 
    6161                             ["username", "password", "country"], \ 
     
    6868        answer = "You answered :\n%s" % "\n".join(["%s => '%s'" % (k, v.data) for (k, v) in result.items() if k != "isValid"]) 
    6969        server.showDialog(xmlrpclib.Binary(answer.encode("UTF-8")), False) 
    70     else :     
     70    else : 
    7171        print "The answers are not valid." 
    72          
    73     # Now do nothing :     
     72 
     73    # Now do nothing : 
    7474    server.nop() 
    75          
     75 
    7676    # Finally we will cause PyKotIcon to die 
    7777    message3 = "As soon as you'll click on the button below, PyKotIcon will die." 
    7878    server.showDialog(xmlrpclib.Binary(message3.encode("UTF-8")), False) 
    7979    server.quitApplication() 
    80      
     80 
    8181    # That's all folks ! 
    8282    print 
    8383    print "This demo is finished. Did you like it ?" 
    84          
     84 
    8585if __name__ == "__main__" : 
    8686    if len(sys.argv) < 3 : 
    8787        sys.stderr.write("usage : %s pykoticon_hostname_or_ip_address pykoticon_TCPPort\n" % sys.argv[0]) 
    88     else :     
     88    else : 
    8989        try : 
    9090            main(sys.argv[1:]) 
    91         except socket.error, msg :     
     91        except socket.error, msg : 
    9292            sys.stderr.write("ERROR : Network error : %s\n" % msg) 
    9393            sys.stderr.write("Are you sure that PyKotIcon is running and accepts incoming connections ?\n") 
    94              
     94 
  • pykoticon/trunk/TODO

    r181 r3439  
    2222TODO, in no particular order : 
    2323 
    24     - Add a way to provide an additional text when using  
     24    - Add a way to provide an additional text when using 
    2525      pknotify --ask. 
    26        
    27     - Don't display anything or even initialize the graphical interface   
     26 
     27    - Don't display anything or even initialize the graphical interface 
    2828      until an incoming connection is received : this will allow 
    2929      a single instance to be launched and choose its display 
    3030      at connection time for use on terminal servers. 
    31        
    32     - Add a command line parameter to control the window's modal/modeless   
     31 
     32    - Add a command line parameter to control the window's modal/modeless 
    3333      mode. The default will not be modal in any case. 
    34        
     34 
    3535    - SSL or other encryption support. 
    36      
     36 
    3737    - Fix focus problem reported by some people. 
    38      
     38 
    3939============================================================ 
    4040