Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv28849

Modified Files:
        mediamenu.py 
Log Message:
Commiting Brian J. Murrell's password protected folder patch so that people can hide 
their porn.  This uses the new PasswordInputBox and modified for other new gui code as 
well.


Index: mediamenu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/mediamenu.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** mediamenu.py        30 Mar 2003 14:18:16 -0000      1.43
--- mediamenu.py        30 Mar 2003 20:55:25 -0000      1.44
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.44  2003/03/30 20:55:25  rshortt
+ # Commiting Brian J. Murrell's password protected folder patch so that people can 
hide their porn.  This uses the new PasswordInputBox and modified for other new gui 
code as well.
+ #
  # Revision 1.43  2003/03/30 14:18:16  dischi
  # Added FORCE_SKIN_LAYOUT and changed to layout of folder.fxd (see
***************
*** 158,161 ****
--- 161,172 ----
  import games.interface
  
+ from osd import SynchronizedObject
+ import osd
+ osd = osd.get_singleton()
+ from item import Item
+ 
+ import gui.PasswordInputBox as PasswordInputBox
+ import gui.AlertBox as AlertBox
+ 
  # XML support
  from xml.utils import qp_xml
***************
*** 460,463 ****
--- 471,509 ----
                  self.media = media
  
+       if os.path.isfile(self.dir + '/.password'):
+           print 'password protected dir'
+           pb = PasswordInputBox(osd.focused_app, 'Enter Password', 
+                                   self.pass_cmp_cb)
+           pb.show()
+           # save these so the InputBox callback can pass them to do_cwd
+           self.arg = arg
+           self.menuw = menuw
+           self.foo = "bar"
+       else:
+           self.do_cwd(arg, menuw)
+ 
+ 
+     def pass_cmp_cb(self, word=None):
+ 
+       # read the contents of self.dir/.passwd and compare to word
+       try:
+           pwfile = open(self.dir + '/.password')
+           line = pwfile.readline()
+       except IOError, e:
+           print 'error %d (%s) reading password file for %s' % \
+                 (e.errno, e.strerror, self.dir)
+           return
+ 
+       pwfile.close()
+       password = line.strip()
+       if word == password:
+           self.do_cwd(self.arg, self.menuw)
+       else:
+           pb = AlertBox(osd.focused_app, 'Password incorrect')
+           pb.show()
+             return
+ 
+ 
+     def do_cwd(self, arg=None, menuw=None):
          try:
              files = ([ os.path.join(self.dir, fname)




-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to