Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-08-06 Thread Walter Bender
On Fri, Aug 6, 2010 at 10:11 AM, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Fri Jul 30 13:09:20 +0200 2010:

 [...]
 -# FLAG_PATH is used to preserve status between boots.
 -FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
 +# FLAG_FILE is used to preserve status between boots.
 +FLAG_FILE = '.olpc-pentablet-mode'
 [...]

 Thanks, this looks much better!
 To me it makes more sense to show it as a device icon rather than a control
 panel. Plus in the former case we could add a keyboard shortcut to switch
 modes. Technically would could do that even for the control panel, but it
 would be rather obscure, whereas the device icon palette can show the
 shortcut (= discoverable).
 But if it isn't possible to convert this to a device icon within the 0.90
 time limits (UI freeze is pretty soon IIRC), I'd rather have a control
 panel than nothing at all. So please post the full updated patch (with
 git-send-email if possible) and I'll try to have another go at it.

 Sascha

Will do ASAP.

-walter

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel





-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-08-06 Thread Walter Bender
On Fri, Aug 6, 2010 at 2:49 PM, Walter Bender walter.ben...@gmail.com wrote:
 On Fri, Aug 6, 2010 at 10:11 AM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Fri Jul 30 13:09:20 +0200 2010:

 [...]
 -# FLAG_PATH is used to preserve status between boots.
 -FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
 +# FLAG_FILE is used to preserve status between boots.
 +FLAG_FILE = '.olpc-pentablet-mode'
 [...]

 Thanks, this looks much better!
 To me it makes more sense to show it as a device icon rather than a control
 panel. Plus in the former case we could add a keyboard shortcut to switch
 modes. Technically would could do that even for the control panel, but it
 would be rather obscure, whereas the device icon palette can show the
 shortcut (= discoverable).
 But if it isn't possible to convert this to a device icon within the 0.90
 time limits (UI freeze is pretty soon IIRC), I'd rather have a control
 panel than nothing at all. So please post the full updated patch (with
 git-send-email if possible) and I'll try to have another go at it.

 Sascha

 Will do ASAP.

http://bugs.sugarlabs.org/attachment/ticket/2006/0001-add-touchpad-device-to-Frame.patch
http://bugs.sugarlabs.org/attachment/ticket/2006/0001-icons-used-for-touchpad-device.patch

Sorry, but no time today to wrestle with my email client :(

-walter

 -walter

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel





 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-30 Thread Walter Bender
Sorry. -u this time:

--- /home/walter/Desktop/walters-sugar-clone/extensions/deviceicon/touchpad.py  
2010-07-20
13:23:44.0 -0400
+++ touchpad.py 2010-07-29 22:25:37.0 -0400
@@ -32,8 +32,8 @@
 STATUS_TEXT = {TOUCHPAD_MODES[0]: _('finger'), TOUCHPAD_MODES[1]: _('stylus')}
 STATUS_ICON = {TOUCHPAD_MODES[0]: 'touchpad-' + TOUCHPAD_MODES[0],
TOUCHPAD_MODES[1]: 'touchpad-' + TOUCHPAD_MODES[1]}
-# FLAG_PATH is used to preserve status between boots.
-FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
+# FLAG_FILE is used to preserve status between boots.
+FLAG_FILE = '.olpc-pentablet-mode'
 # NODE_PATH is used to communicate with the touchpad device.
 NODE_PATH = '/sys/devices/platform/i8042/serio1/ptmode'

@@ -102,6 +102,10 @@
  Touchpad palette only appears when the device exisits. 
 if os.path.exists(NODE_PATH):
 tray.add_device(DeviceView())
+# if _flag_path exists, set the initial device value to stylus
+_flag_path = os.join(os.environ['HOME'], FLAG_FILE)
+if os.path.exists(_flag_path):
+write_to_node_file(str(TOUCHPAD_MODES.index('stylus')))


 def read_touchpad_mode():
@@ -117,13 +121,23 @@
  Write the touchpad mode to the node path and set/unset the flag. 
 touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)

-node_file_handle = open(NODE_PATH, 'w')
-node_file_handle.write(str(touchpad_mode_index))
-node_file_handle.close()
+write_to_node_file(str(touchpad_mode_index))

+_flag_path = os.join(os.environ['HOME'], FLAG_FILE)
 if touchpad_mode_index == 0:
-if os.path.exists(FLAG_PATH):
+if os.path.exists(_flag_path):
 os.remove(FLAG_PATH)
 else:
-flag_file_handle = open(FLAG_PATH, 'w')
+flag_file_handle = open(_flag_path, 'w')
 flag_file_handle.close()
+
+
+def write_to_node_file(value):
+ Write to node path, catching exception is there is a problem 
+try:
+node_file_handle = open(NODE_PATH, 'w')
+except IOError, e:
+print e
+return
+node_file_handle.write(value)
+node_file_handle.close()

On Thu, Jul 29, 2010 at 11:20 PM, Paul Fox p...@laptop.org wrote:
 walter wrote:
   On Thu, Jul 29, 2010 at 5:37 PM, Paul Fox p...@laptop.org wrote:
    walter wrote:
      On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
      pbrobin...@gmail.com wrote:
       On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
       sascha-ml-ui-sugar-de...@silbe.org wrote:
       Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
       sascha wrote:
         Even your latest patch still contains code that is specific to 
 OLPC
      builds and will break on other systems.
         Of course it's perfectly fine for you to say you only care 
 about
   OLPC
      builds for XO-1 (because the number of XO-1s running non-OLPC builds 
 is
      minimal, especially if you don't count developers). But in that case 
 your
   patch
      should be included in the OLPC builds, not in Sugar mainline.
      
       can you remind me of the specific issue(s) here?
       I can remember two issues (there might be others as well):
       - hardcoded, absolute path (/home/olpc/whatever)
      
       I agree that it shouldn't ever user /home/olpc as hardcoded. At 
 least
       you ~/.olpc-blah as it will then work on what ever distro and what
       ever user. I'm not sure of the general standard to use for this.
     
      How's this look?
   
    walter -- i didn't think of this when we were designing all of
    this:  how about if, in addition to this patch, you checked at sugar
    startup time and used the presence of that file in $HOME as an
    indication that you should set ptmode for the user?  then i could
    eliminate a chunk of the code from olpc-utils that sascha was
    complaining about.
   
    btw -- i just looked at your patch again -- what happens if
    NODE_PATH can't be opened for writing?  write_touchpad_mode()
    should fail gracefully in that case.  making the node writeable
    is the one line of code that will need to remain external to
    sugar, and we shouldn't assume that it has happened.  i'm
    referring to this:
   
       +def write_touchpad_mode(touchpad):
       +     Write the touchpad mode to the node path and set/unset the 
 flag.
   
       +    touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
       +
       +    node_file_handle = open(NODE_PATH, 'w')
       +    node_file_handle.write(str(touchpad_mode_index))
       +    node_file_handle.close()
       +
       +    if touchpad_mode_index == 0:
       +        if os.path.exists(FLAG_PATH):
       +            os.remove(FLAG_PATH)
       +    else:
       +        flag_file_handle = open(FLAG_PATH, 'w')
       +        flag_file_handle.close()
   
    paul
   
   
     
      35,36c35,36
       # FLAG_PATH is used to preserve status between boots.
       FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
      ---
       # 

Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-30 Thread Paul Fox
hi walter -- looks good. the initialization code in olpc-utils until
this patch makes it to all the right places.

paul

i'll leave the initialization code in olpc-utils 
walter wrote:
  Sorry. -u this time:
  
  --- 
  /home/walter/Desktop/walters-sugar-clone/extensions/deviceicon/touchpad.py   
  
  2010-07-20
  13:23:44.0 -0400
  +++ touchpad.py  2010-07-29 22:25:37.0 -0400
  @@ -32,8 +32,8 @@
   STATUS_TEXT = {TOUCHPAD_MODES[0]: _('finger'), TOUCHPAD_MODES[1]: 
  _('stylus')}
   STATUS_ICON = {TOUCHPAD_MODES[0]: 'touchpad-' + TOUCHPAD_MODES[0],
  TOUCHPAD_MODES[1]: 'touchpad-' + TOUCHPAD_MODES[1]}
  -# FLAG_PATH is used to preserve status between boots.
  -FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
  +# FLAG_FILE is used to preserve status between boots.
  +FLAG_FILE = '.olpc-pentablet-mode'
   # NODE_PATH is used to communicate with the touchpad device.
   NODE_PATH = '/sys/devices/platform/i8042/serio1/ptmode'
  
  @@ -102,6 +102,10 @@
Touchpad palette only appears when the device exisits. 
   if os.path.exists(NODE_PATH):
   tray.add_device(DeviceView())
  +# if _flag_path exists, set the initial device value to stylus
  +_flag_path = os.join(os.environ['HOME'], FLAG_FILE)
  +if os.path.exists(_flag_path):
  +write_to_node_file(str(TOUCHPAD_MODES.index('stylus')))
  
  
   def read_touchpad_mode():
  @@ -117,13 +121,23 @@
Write the touchpad mode to the node path and set/unset the flag. 
   touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
  
  -node_file_handle = open(NODE_PATH, 'w')
  -node_file_handle.write(str(touchpad_mode_index))
  -node_file_handle.close()
  +write_to_node_file(str(touchpad_mode_index))
  
  +_flag_path = os.join(os.environ['HOME'], FLAG_FILE)
   if touchpad_mode_index == 0:
  -if os.path.exists(FLAG_PATH):
  +if os.path.exists(_flag_path):
   os.remove(FLAG_PATH)
   else:
  -flag_file_handle = open(FLAG_PATH, 'w')
  +flag_file_handle = open(_flag_path, 'w')
   flag_file_handle.close()
  +
  +
  +def write_to_node_file(value):
  + Write to node path, catching exception is there is a problem 
  +try:
  +node_file_handle = open(NODE_PATH, 'w')
  +except IOError, e:
  +print e
  +return
  +node_file_handle.write(value)
  +node_file_handle.close()
  
  On Thu, Jul 29, 2010 at 11:20 PM, Paul Fox p...@laptop.org wrote:
   walter wrote:
 On Thu, Jul 29, 2010 at 5:37 PM, Paul Fox p...@laptop.org wrote:
  walter wrote:
On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
pbrobin...@gmail.com wrote:
 On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 
   2010:
 sascha wrote:
   Even your latest patch still contains code that is specific 
   to 
  OLPC
builds and will break on other systems.
   Of course it's perfectly fine for you to say you only care 
  about
 OLPC
builds for XO-1 (because the number of XO-1s running non-OLPC 
   builds 
  is
minimal, especially if you don't count developers). But in that 
   case 
  your
 patch
should be included in the OLPC builds, not in Sugar mainline.

 can you remind me of the specific issue(s) here?
 I can remember two issues (there might be others as well):
 - hardcoded, absolute path (/home/olpc/whatever)

 I agree that it shouldn't ever user /home/olpc as hardcoded. At 
  least
 you ~/.olpc-blah as it will then work on what ever distro and 
   what
 ever user. I'm not sure of the general standard to use for this.
   
How's this look?
 
  walter -- i didn't think of this when we were designing all of
  this:  how about if, in addition to this patch, you checked at sugar
  startup time and used the presence of that file in $HOME as an
  indication that you should set ptmode for the user?  then i could
  eliminate a chunk of the code from olpc-utils that sascha was
  complaining about.
 
  btw -- i just looked at your patch again -- what happens if
  NODE_PATH can't be opened for writing?  write_touchpad_mode()
  should fail gracefully in that case.  making the node writeable
  is the one line of code that will need to remain external to
  sugar, and we shouldn't assume that it has happened.  i'm
  referring to this:
 
 +def write_touchpad_mode(touchpad):
 + Write the touchpad mode to the node path and set/unset 
   the 
  flag.
 
 +touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
 +
 +node_file_handle = open(NODE_PATH, 'w')
 +node_file_handle.write(str(touchpad_mode_index))
 +

Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-29 Thread pbrobin...@gmail.com
On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
 sascha wrote:
   Even your latest patch still contains code that is specific to OLPC 
 builds and will break on other systems.
   Of course it's perfectly fine for you to say you only care about OLPC 
 builds for XO-1 (because the number of XO-1s running non-OLPC builds is 
 minimal, especially if you don't count developers). But in that case your 
 patch should be included in the OLPC builds, not in Sugar mainline.

 can you remind me of the specific issue(s) here?
 I can remember two issues (there might be others as well):
 - hardcoded, absolute path (/home/olpc/whatever)

I agree that it shouldn't ever user /home/olpc as hardcoded. At least
you ~/.olpc-blah as it will then work on what ever distro and what
ever user. I'm not sure of the general standard to use for this.

Peter
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-29 Thread Walter Bender
On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
pbrobin...@gmail.com wrote:
 On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
 sascha wrote:
   Even your latest patch still contains code that is specific to OLPC 
 builds and will break on other systems.
   Of course it's perfectly fine for you to say you only care about OLPC 
 builds for XO-1 (because the number of XO-1s running non-OLPC builds is 
 minimal, especially if you don't count developers). But in that case your 
 patch should be included in the OLPC builds, not in Sugar mainline.

 can you remind me of the specific issue(s) here?
 I can remember two issues (there might be others as well):
 - hardcoded, absolute path (/home/olpc/whatever)

 I agree that it shouldn't ever user /home/olpc as hardcoded. At least
 you ~/.olpc-blah as it will then work on what ever distro and what
 ever user. I'm not sure of the general standard to use for this.

How's this look?

35,36c35,36
 # FLAG_PATH is used to preserve status between boots.
 FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
---
 # FLAG_FILE is used to preserve status between boots.
 FLAG_FILE = '.olpc-pentablet-mode'
123a124
 _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
125,126c126,127
 if os.path.exists(FLAG_PATH):
 os.remove(FLAG_PATH)
---
 if os.path.exists(_flag_path):
 os.remove(_flag_path)
128c129
 flag_file_handle = open(FLAG_PATH, 'w')
---
 flag_file_handle = open(_flag_path, 'w')

-walter

 Peter
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-29 Thread Paul Fox
walter wrote:
  On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
  pbrobin...@gmail.com wrote:
   On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
   sascha-ml-ui-sugar-de...@silbe.org wrote:
   Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
   sascha wrote:
 Even your latest patch still contains code that is specific to OLPC 
  builds and will break on other systems.
 Of course it's perfectly fine for you to say you only care about OLPC 
  builds for XO-1 (because the number of XO-1s running non-OLPC builds is 
  minimal, especially if you don't count developers). But in that case your 
  patch 
  should be included in the OLPC builds, not in Sugar mainline.
  
   can you remind me of the specific issue(s) here?
   I can remember two issues (there might be others as well):
   - hardcoded, absolute path (/home/olpc/whatever)
  
   I agree that it shouldn't ever user /home/olpc as hardcoded. At least
   you ~/.olpc-blah as it will then work on what ever distro and what
   ever user. I'm not sure of the general standard to use for this.
  
  How's this look?

walter -- i didn't think of this when we were designing all of
this:  how about if, in addition to this patch, you checked at sugar
startup time and used the presence of that file in $HOME as an
indication that you should set ptmode for the user?  then i could
eliminate a chunk of the code from olpc-utils that sascha was
complaining about.

btw -- i just looked at your patch again -- what happens if
NODE_PATH can't be opened for writing?  write_touchpad_mode()
should fail gracefully in that case.  making the node writeable
is the one line of code that will need to remain external to
sugar, and we shouldn't assume that it has happened.  i'm
referring to this:

+def write_touchpad_mode(touchpad):
+ Write the touchpad mode to the node path and set/unset the flag. 

+touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
+
+node_file_handle = open(NODE_PATH, 'w')
+node_file_handle.write(str(touchpad_mode_index))
+node_file_handle.close()
+
+if touchpad_mode_index == 0:
+if os.path.exists(FLAG_PATH):
+os.remove(FLAG_PATH)
+else:
+flag_file_handle = open(FLAG_PATH, 'w')
+flag_file_handle.close()

paul


  
  35,36c35,36
   # FLAG_PATH is used to preserve status between boots.
   FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
  ---
   # FLAG_FILE is used to preserve status between boots.
   FLAG_FILE = '.olpc-pentablet-mode'
  123a124
   _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
  125,126c126,127
   if os.path.exists(FLAG_PATH):
   os.remove(FLAG_PATH)
  ---
   if os.path.exists(_flag_path):
   os.remove(_flag_path)
  128c129
   flag_file_handle = open(FLAG_PATH, 'w')
  ---
   flag_file_handle = open(_flag_path, 'w')
  
  -walter
  
   Peter
   ___
   Sugar-devel mailing list
   Sugar-devel@lists.sugarlabs.org
   http://lists.sugarlabs.org/listinfo/sugar-devel
  
  
  
  
  -- 
  Walter Bender
  Sugar Labs
  http://www.sugarlabs.org
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel

=-
 paul fox, p...@laptop.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-29 Thread Walter Bender
On Thu, Jul 29, 2010 at 5:37 PM, Paul Fox p...@laptop.org wrote:
 walter wrote:
   On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
   pbrobin...@gmail.com wrote:
    On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
    sascha-ml-ui-sugar-de...@silbe.org wrote:
    Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
    sascha wrote:
      Even your latest patch still contains code that is specific to OLPC
   builds and will break on other systems.
      Of course it's perfectly fine for you to say you only care about 
 OLPC
   builds for XO-1 (because the number of XO-1s running non-OLPC builds is
   minimal, especially if you don't count developers). But in that case your 
 patch
   should be included in the OLPC builds, not in Sugar mainline.
   
    can you remind me of the specific issue(s) here?
    I can remember two issues (there might be others as well):
    - hardcoded, absolute path (/home/olpc/whatever)
   
    I agree that it shouldn't ever user /home/olpc as hardcoded. At least
    you ~/.olpc-blah as it will then work on what ever distro and what
    ever user. I'm not sure of the general standard to use for this.
  
   How's this look?

 walter -- i didn't think of this when we were designing all of
 this:  how about if, in addition to this patch, you checked at sugar
 startup time and used the presence of that file in $HOME as an
 indication that you should set ptmode for the user?  then i could
 eliminate a chunk of the code from olpc-utils that sascha was
 complaining about.

 btw -- i just looked at your patch again -- what happens if
 NODE_PATH can't be opened for writing?  write_touchpad_mode()
 should fail gracefully in that case.  making the node writeable
 is the one line of code that will need to remain external to
 sugar, and we shouldn't assume that it has happened.  i'm
 referring to this:

    +def write_touchpad_mode(touchpad):
    +     Write the touchpad mode to the node path and set/unset the flag. 
 
    +    touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
    +
    +    node_file_handle = open(NODE_PATH, 'w')
    +    node_file_handle.write(str(touchpad_mode_index))
    +    node_file_handle.close()
    +
    +    if touchpad_mode_index == 0:
    +        if os.path.exists(FLAG_PATH):
    +            os.remove(FLAG_PATH)
    +    else:
    +        flag_file_handle = open(FLAG_PATH, 'w')
    +        flag_file_handle.close()

 paul


  
   35,36c35,36
    # FLAG_PATH is used to preserve status between boots.
    FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
   ---
    # FLAG_FILE is used to preserve status between boots.
    FLAG_FILE = '.olpc-pentablet-mode'
   123a124
        _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
   125,126c126,127
            if os.path.exists(FLAG_PATH):
                os.remove(FLAG_PATH)
   ---
            if os.path.exists(_flag_path):
                os.remove(_flag_path)
   128c129
            flag_file_handle = open(FLAG_PATH, 'w')
   ---
            flag_file_handle = open(_flag_path, 'w')
  
   -walter
   
    Peter
    ___
    Sugar-devel mailing list
    Sugar-devel@lists.sugarlabs.org
    http://lists.sugarlabs.org/listinfo/sugar-devel
   
  
  
  
   --
   Walter Bender
   Sugar Labs
   http://www.sugarlabs.org
   ___
   Sugar-devel mailing list
   Sugar-devel@lists.sugarlabs.org
   http://lists.sugarlabs.org/listinfo/sugar-devel

 =-
  paul fox, p...@laptop.org


This do the trick?

35,36c35,36
 # FLAG_PATH is used to preserve status between boots.
 FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
---
 # FLAG_FILE is used to preserve status between boots.
 FLAG_FILE = '.olpc-pentablet-mode'
104a105,108
 _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
 # if _flag_path exists, set the initial device value to stylus
 if os.path.exists(_flag_path):
 write_to_node_file(str(TOUCHPAD_MODES.index('stylus')))
120,122c124
 node_file_handle = open(NODE_PATH, 'w')
 node_file_handle.write(str(touchpad_mode_index))
 node_file_handle.close()
---
 write_to_node_file(str(touchpad_mode_index))
123a126
 _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
125c128
 if os.path.exists(FLAG_PATH):
---
 if os.path.exists(_flag_path):
128c131
 flag_file_handle = open(FLAG_PATH, 'w')
---
 flag_file_handle = open(_flag_path, 'w')
129a133,143


 def write_to_node_file(value):
  Write to node path, catching exception is there is a problem 
 try:
 node_file_handle = open(NODE_PATH, 'w')
 except IOError, e:
 print e
 return
 node_file_handle.write(value)
 node_file_handle.close()

-walter
-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-29 Thread Paul Fox
walter wrote:
  On Thu, Jul 29, 2010 at 5:37 PM, Paul Fox p...@laptop.org wrote:
   walter wrote:
 On Thu, Jul 29, 2010 at 6:27 AM, pbrobin...@gmail.com
 pbrobin...@gmail.com wrote:
  On Wed, Jul 28, 2010 at 3:41 PM, Sascha Silbe
  sascha-ml-ui-sugar-de...@silbe.org wrote:
  Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
  sascha wrote:
Even your latest patch still contains code that is specific to 
   OLPC
 builds and will break on other systems.
Of course it's perfectly fine for you to say you only care about 
  OLPC
 builds for XO-1 (because the number of XO-1s running non-OLPC builds is
 minimal, especially if you don't count developers). But in that case 
   your 
  patch
 should be included in the OLPC builds, not in Sugar mainline.
 
  can you remind me of the specific issue(s) here?
  I can remember two issues (there might be others as well):
  - hardcoded, absolute path (/home/olpc/whatever)
 
  I agree that it shouldn't ever user /home/olpc as hardcoded. At least
  you ~/.olpc-blah as it will then work on what ever distro and what
  ever user. I'm not sure of the general standard to use for this.

 How's this look?
  
   walter -- i didn't think of this when we were designing all of
   this:  how about if, in addition to this patch, you checked at sugar
   startup time and used the presence of that file in $HOME as an
   indication that you should set ptmode for the user?  then i could
   eliminate a chunk of the code from olpc-utils that sascha was
   complaining about.
  
   btw -- i just looked at your patch again -- what happens if
   NODE_PATH can't be opened for writing?  write_touchpad_mode()
   should fail gracefully in that case.  making the node writeable
   is the one line of code that will need to remain external to
   sugar, and we shouldn't assume that it has happened.  i'm
   referring to this:
  
  +def write_touchpad_mode(touchpad):
  + Write the touchpad mode to the node path and set/unset the 
   flag. 
  
  +touchpad_mode_index = TOUCHPAD_MODES.index(touchpad)
  +
  +node_file_handle = open(NODE_PATH, 'w')
  +node_file_handle.write(str(touchpad_mode_index))
  +node_file_handle.close()
  +
  +if touchpad_mode_index == 0:
  +if os.path.exists(FLAG_PATH):
  +os.remove(FLAG_PATH)
  +else:
  +flag_file_handle = open(FLAG_PATH, 'w')
  +flag_file_handle.close()
  
   paul
  
  

 35,36c35,36
  # FLAG_PATH is used to preserve status between boots.
  FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
 ---
  # FLAG_FILE is used to preserve status between boots.
  FLAG_FILE = '.olpc-pentablet-mode'
 123a124
  _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
 125,126c126,127
  if os.path.exists(FLAG_PATH):
  os.remove(FLAG_PATH)
 ---
  if os.path.exists(_flag_path):
  os.remove(_flag_path)
 128c129
  flag_file_handle = open(FLAG_PATH, 'w')
 ---
  flag_file_handle = open(_flag_path, 'w')

 -walter
 
  Peter
  ___
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
 



 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel
  
   =-
paul fox, p...@laptop.org
  
  
  This do the trick?

it might.  it's really hard to tell without the -u option to
patch.  line number patches are so last century.  ;-)

paul

  
  35,36c35,36
   # FLAG_PATH is used to preserve status between boots.
   FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
  ---
   # FLAG_FILE is used to preserve status between boots.
   FLAG_FILE = '.olpc-pentablet-mode'
  104a105,108
   _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
   # if _flag_path exists, set the initial device value to stylus
   if os.path.exists(_flag_path):
   write_to_node_file(str(TOUCHPAD_MODES.index('stylus')))
  120,122c124
   node_file_handle = open(NODE_PATH, 'w')
   node_file_handle.write(str(touchpad_mode_index))
   node_file_handle.close()
  ---
   write_to_node_file(str(touchpad_mode_index))
  123a126
   _flag_path = os.join(os.environ['HOME'], FLAG_FILE)
  125c128
   if os.path.exists(FLAG_PATH):
  ---
   if os.path.exists(_flag_path):
  128c131
   flag_file_handle = open(FLAG_PATH, 'w')
  ---
   flag_file_handle = open(_flag_path, 'w')
  129a133,143
  
  
   def write_to_node_file(value):
Write to node path, catching exception 

Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-28 Thread Sascha Silbe
Excerpts from Walter Bender's message of Tue Jul 27 00:01:01 +0200 2010:

 Not sure what else I can do. I've incorporated all of the suggestion
 from Marco et al. Just awaiting final review.
Even your latest patch still contains code that is specific to OLPC builds and 
will break on other systems.
Of course it's perfectly fine for you to say you only care about OLPC builds 
for XO-1 (because the number of XO-1s running non-OLPC builds is minimal, 
especially if you don't count developers). But in that case your patch should 
be included in the OLPC builds, not in Sugar mainline.

Sascha

--
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-28 Thread Walter Bender
On Wed, Jul 28, 2010 at 3:48 AM, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Tue Jul 27 00:01:01 +0200 2010:

 Not sure what else I can do. I've incorporated all of the suggestion
 from Marco et al. Just awaiting final review.
 Even your latest patch still contains code that is specific to OLPC builds 
 and will break on other systems.

I understand that it is specific to OLPC, since it is for supporting
hardware that is only found on the OLPC. But this is the first I have
heard that it will break on other systems. Is my test in setup somehow
inadequate?

 Of course it's perfectly fine for you to say you only care about OLPC builds 
 for XO-1 (because the number of XO-1s running non-OLPC builds is minimal, 
 especially if you don't count developers). But in that case your patch should 
 be included in the OLPC builds, not in Sugar mainline.

To include this in OLPC builds and not Sugar in general is a
reasonable argument. The only counter argument I could make would be
that some portion of the OLPC users are relying on builds that are not
provided directly by OLPC. As long as there is a way to pull these
bits in for them, it matters not to me whom provides them.

thanks.

-walter


 Sascha

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel





-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-28 Thread Sascha Silbe
Excerpts from Walter Bender's message of Wed Jul 28 13:31:36 +0200 2010:

  Even your latest patch still contains code that is specific to OLPC builds 
  and will break on other systems.
 I understand that it is specific to OLPC, since it is for supporting
 hardware that is only found on the OLPC.
You're mixing terms that are related, but differ in their exact meaning. This 
seems to confuse you:

 But this is the first I have heard that it will break on other systems. Is my 
 test in setup somehow
 inadequate?

This is a feature specific to XO-1 *hardware*. You have written it in a way 
that makes it work only when running a specific *distribution* that has been 
developed by OLPC (upper-case I guess). This distribution (derived from Fedora) 
has no name of it's own, so people just talk about OLPC builds to refer to it.
If somebody - like me - runs a non-OLPC distribution on their XO-1, your patch 
will break. I haven't checked whether it would just render the feature unusable 
or break unrelated parts (e.g. the keyboard selection is known to make Sugar 
fail to start up at all on armel [1]).

  Of course it's perfectly fine for you to say you only care about OLPC 
  builds for XO-1 (because the number of XO-1s running non-OLPC builds is 
  minimal, especially if you don't count developers). But in that case your 
  patch should be included in the OLPC builds, not in Sugar mainline.
 To include this in OLPC builds and not Sugar in general is a
 reasonable argument. The only counter argument I could make would be
 that some portion of the OLPC users are relying on builds that are not
 provided directly by OLPC.
There are two options:

1. They indeed use a different distribution. In that case your patch wouldn't 
work for them in the first place.
2. They are running a derivative of the OLPC distribution. In that case they 
should be able to pick up Sugar packages with your patch from OLPC.

Sascha

[1] https://bugs.sugarlabs.org/ticket/1672


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-28 Thread Paul Fox
sascha wrote:
  
  Excerpts from Walter Bender's message of Tue Jul 27 00:01:01 +0200 2010:
  
   Not sure what else I can do. I've incorporated all of the suggestion
   from Marco et al. Just awaiting final review.
  Even your latest patch still contains code that is specific to OLPC builds 
  and will break on other systems.
  Of course it's perfectly fine for you to say you only care about OLPC builds 
  for XO-1 (because the number of XO-1s running non-OLPC builds is minimal, 
  especially if you don't count developers). But in that case your patch 
  should be included in the OLPC builds, not in Sugar mainline.

can you remind me of the specific issue(s) here?

paul
=-
 paul fox, p...@laptop.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-28 Thread Sascha Silbe
Excerpts from Paul Fox's message of Wed Jul 28 16:01:22 +0200 2010:
 sascha wrote:
   Even your latest patch still contains code that is specific to OLPC builds 
 and will break on other systems.
   Of course it's perfectly fine for you to say you only care about OLPC 
 builds for XO-1 (because the number of XO-1s running non-OLPC builds is 
 minimal, especially if you don't count developers). But in that case your 
 patch should be included in the OLPC builds, not in Sugar mainline.
 
 can you remind me of the specific issue(s) here?
I can remember two issues (there might be others as well):
- hardcoded, absolute path (/home/olpc/whatever)
- reliance on code that is shipped in olpc-utils

Sascha

--
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-26 Thread David Farning
On Tue, May 25, 2010 at 7:05 PM, Walter Bender walter.ben...@gmail.com wrote:
 On Tue, May 25, 2010 at 8:50 AM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Tue May 18 20:08:58 + 2010:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.
 Thanks for working on this!
 While at least some users will probably want a faster way (read: a hotkey)
 to do this, a Control Panel section is more discoverable and a hotkey
 would be better implemented in olpc-kbdshim rather than Sugar.

 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
 I'd prefer that code to live in olpc-kbdshim as olpc-utils is specific to
 the OLPC builds.

 [extensions/cpsection/touchpad/model.py]
 def get_touchpad():
     Get the touchpad mode.
     if path.exists('/home/olpc/.olpc-pentablet-mode'):
 Again, this won't work on non-OLPC builds. For this reason I can't test
 your patch, sorry.

 def set_touchpad(touchpad):
     Set the touchpad mode.
     if touchpad == _CAPACITIVE:
         system(rm /home/olpc/.olpc-pentablet-mode)
 Please use os.remove() instead.

 def print_touchpad():
     Print the future touchpad mode.
     if get_touchpad == _CAPACITIVE:
         print _('Touchpad will be set to finger mode on next reboot.')
 Typo: get_touchpad(). But I don't see print_touchpad() used anyway, so
 you can just drop it. If you'd like to output this message, please use
 logging.info() instead.

 [extensions/cpsection/touchpad/view.py]
 _CAPACITIVE = 0
 _RESISTIVE = 1
 Please define these constants in a single place only (they are defined in
 extensions/cpsection/touchpad/model.py, too). Actually I'd prefer the use
 of literal strings instead, that way you don't need to define constants.

 class TouchpadEventIcon(gtk.EventBox):
 I suppose TouchpadEventIcon is meant to be used by TouchpadPicker / Touchpad
 exclusively. In that case it should be made private, i.e. the name
 should be prefixed with an underscore (_TouchpadPicker).

     A subclass of the Sugar Event Icon
 Is it? The code says otherwise. ;)
 In general, a comment saying A subclass of X isn't useful and can be
 left out. Of course a more meaningful description would be even better.

     def __init__(self, **kwargs):
         Create an extra-large, clickable icon.
 If rephrased slightly, this is a good candidate for the TouchpadEventIcon
 docstring.

 class TouchpadPicker(TouchpadEventIcon):
     A class for the touchpad selection buttons
 Like above, A class for is redundant. And what's the difference between
 TouchpadEventIcon and TouchpadPicker?

 class Touchpad(SectionView):
 [...]
         self._touchpad_label = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert = None
 You can leave out touchpad_ from these names as it's clear from the
 context. As the names are now shorter, you can also rename
 self._touchpad_label to self._label_box as it only contains the box holding
 the label, not the label itself (which will be created later in
 _setup_touchpad()).

     def _setup_touchpad(self):
 This would probably better be named _setup_widgets(), as it creates a set
 of widgets, whereas from the name I'd have expected it to (physically)
 configure the touchpad mode.

     def undo(self):
         Undo any changes.
         for widget, handler in self._handlers:
             widget.disconnect(handler)
 Do we need to disconnect the handlers manually? Won't PyGTK handle this
 for us during garbage collection?
 If PyGTK handles it, you can drop self._handlers (and simplify setup()).
 Otherwise we should do it in any case, not just in undo().


 I've ignored any alert-related code as others have already pointed out
 this panel should change the mode at run-time, rather than requiring a
 reboot.


 PS: Please give git send-email a try. It sends the patches in a way that
 makes them easier to review.

 Sascha
 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



 Thanks. Great feedback... I'll learn Python one of these days :)

 -walter

Walter,

I you get a chance can you take another look at the patch.  PY is
carrying it in their local tree but it has not been accepted in sugar.

david
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-26 Thread Walter Bender
On Mon, Jul 26, 2010 at 11:50 AM, David Farning dfarn...@gmail.com wrote:
 On Tue, May 25, 2010 at 7:05 PM, Walter Bender walter.ben...@gmail.com 
 wrote:
 On Tue, May 25, 2010 at 8:50 AM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Tue May 18 20:08:58 + 2010:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.
 Thanks for working on this!
 While at least some users will probably want a faster way (read: a hotkey)
 to do this, a Control Panel section is more discoverable and a hotkey
 would be better implemented in olpc-kbdshim rather than Sugar.

 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
 I'd prefer that code to live in olpc-kbdshim as olpc-utils is specific to
 the OLPC builds.

 [extensions/cpsection/touchpad/model.py]
 def get_touchpad():
     Get the touchpad mode.
     if path.exists('/home/olpc/.olpc-pentablet-mode'):
 Again, this won't work on non-OLPC builds. For this reason I can't test
 your patch, sorry.

 def set_touchpad(touchpad):
     Set the touchpad mode.
     if touchpad == _CAPACITIVE:
         system(rm /home/olpc/.olpc-pentablet-mode)
 Please use os.remove() instead.

 def print_touchpad():
     Print the future touchpad mode.
     if get_touchpad == _CAPACITIVE:
         print _('Touchpad will be set to finger mode on next reboot.')
 Typo: get_touchpad(). But I don't see print_touchpad() used anyway, so
 you can just drop it. If you'd like to output this message, please use
 logging.info() instead.

 [extensions/cpsection/touchpad/view.py]
 _CAPACITIVE = 0
 _RESISTIVE = 1
 Please define these constants in a single place only (they are defined in
 extensions/cpsection/touchpad/model.py, too). Actually I'd prefer the use
 of literal strings instead, that way you don't need to define constants.

 class TouchpadEventIcon(gtk.EventBox):
 I suppose TouchpadEventIcon is meant to be used by TouchpadPicker / Touchpad
 exclusively. In that case it should be made private, i.e. the name
 should be prefixed with an underscore (_TouchpadPicker).

     A subclass of the Sugar Event Icon
 Is it? The code says otherwise. ;)
 In general, a comment saying A subclass of X isn't useful and can be
 left out. Of course a more meaningful description would be even better.

     def __init__(self, **kwargs):
         Create an extra-large, clickable icon.
 If rephrased slightly, this is a good candidate for the TouchpadEventIcon
 docstring.

 class TouchpadPicker(TouchpadEventIcon):
     A class for the touchpad selection buttons
 Like above, A class for is redundant. And what's the difference between
 TouchpadEventIcon and TouchpadPicker?

 class Touchpad(SectionView):
 [...]
         self._touchpad_label = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert = None
 You can leave out touchpad_ from these names as it's clear from the
 context. As the names are now shorter, you can also rename
 self._touchpad_label to self._label_box as it only contains the box holding
 the label, not the label itself (which will be created later in
 _setup_touchpad()).

     def _setup_touchpad(self):
 This would probably better be named _setup_widgets(), as it creates a set
 of widgets, whereas from the name I'd have expected it to (physically)
 configure the touchpad mode.

     def undo(self):
         Undo any changes.
         for widget, handler in self._handlers:
             widget.disconnect(handler)
 Do we need to disconnect the handlers manually? Won't PyGTK handle this
 for us during garbage collection?
 If PyGTK handles it, you can drop self._handlers (and simplify setup()).
 Otherwise we should do it in any case, not just in undo().


 I've ignored any alert-related code as others have already pointed out
 this panel should change the mode at run-time, rather than requiring a
 reboot.


 PS: Please give git send-email a try. It sends the patches in a way that
 makes them easier to review.

 Sascha
 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



 Thanks. Great feedback... I'll learn Python one of these days :)

 -walter

 Walter,

 I you get a chance can you take another look at the patch.  PY is
 carrying it in their local tree but it has not been accepted in sugar.

 david


Not sure what else I can do. I've incorporated all of the suggestion
from Marco et al. Just awaiting final review.

-walter


-- 
Walter Bender
Sugar Labs

[Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-07-20 Thread Walter Bender
Here is another version of the touchpad-on-the-frame patch with all of
the changes recommended by Marco et al.

From 47221ac4277a649c4808231f5616d75d73ab48e0 Mon Sep 17 00:00:00 2001
From: Walter Bender wal...@sugarlabs.org
Date: Tue, 20 Jul 2010 14:11:28 -0400
Subject: [PATCH] touchpad device on frame

---
 extensions/deviceicon/Makefile.am |1 +
 extensions/deviceicon/touchpad.py |  129 +
 2 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 extensions/deviceicon/touchpad.py

diff --git a/extensions/deviceicon/Makefile.am
b/extensions/deviceicon/Makefile.am
index 8a2e765..7f82a3f 100644
--- a/extensions/deviceicon/Makefile.am
+++ b/extensions/deviceicon/Makefile.am
@@ -5,4 +5,5 @@ sugar_PYTHON =  \
battery.py  \
network.py  \
speaker.py  \
+touchpad.py \
volume.py
diff --git a/extensions/deviceicon/touchpad.py
b/extensions/deviceicon/touchpad.py
new file mode 100644
index 000..7f3ecb5
--- /dev/null
+++ b/extensions/deviceicon/touchpad.py
@@ -0,0 +1,129 @@
+# Copyright (C) 2010, Walter Bender, Sugar Labs
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+from gettext import gettext as _
+import os
+
+import gtk
+import gconf
+
+from sugar.graphics.tray import TrayIcon
+from sugar.graphics.xocolor import XoColor
+from sugar.graphics.palette import Palette
+from sugar.graphics import style
+
+from jarabe.frame.frameinvoker import FrameWidgetInvoker
+
+TOUCHPAD_MODES = ['capacitive', 'resistive']
+STATUS_TEXT = {TOUCHPAD_MODES[0]: _('finger'), TOUCHPAD_MODES[1]: _('stylus')}
+STATUS_ICON = {TOUCHPAD_MODES[0]: 'touchpad-' + TOUCHPAD_MODES[0],
+   TOUCHPAD_MODES[1]: 'touchpad-' + TOUCHPAD_MODES[1]}
+# FLAG_PATH is used to preserve status between boots.
+FLAG_PATH = '/home/olpc/.olpc-pentablet-mode'
+# NODE_PATH is used to communicate with the touchpad device.
+NODE_PATH = '/sys/devices/platform/i8042/serio1/ptmode'
+
+class DeviceView(TrayIcon):
+ Manage the touchpad mode from the device palette on the Frame. 
+
+FRAME_POSITION_RELATIVE = 500
+
+def __init__(self):
+ Create the touchpad palette and display it on Frame. 
+icon_name = STATUS_ICON[read_touchpad_mode()]
+
+client = gconf.client_get_default()
+color = XoColor(client.get_string('/desktop/sugar/user/color'))
+TrayIcon.__init__(self, icon_name=icon_name, xo_color=color)
+
+self.set_palette_invoker(FrameWidgetInvoker(self))
+self.connect('button-release-event', self.__button_release_event_cb)
+
+def create_palette(self):
+ On create, set the current mode. 
+self.palette = ResourcePalette(_('My touchpad'), self.icon)
+self.palette.set_group_id('frame')
+return self.palette
+
+def __button_release_event_cb(self, widget, event):
+ On button release, switch modes. 
+self.palette.toggle_mode()
+return True
+
+
+class ResourcePalette(Palette):
+ Query the current state of the touchpad and update the display. 
+
+def __init__(self, primary_text, icon):
+ Create the palette and initilize with current touchpad status. 
+Palette.__init__(self, label=primary_text)
+
+self._icon = icon
+
+vbox = gtk.VBox()
+self.set_content(vbox)
+
+self._status_text = gtk.Label()
+vbox.pack_start(self._status_text, padding=style.DEFAULT_PADDING)
+self._status_text.show()
+
+vbox.show()
+
+self._mode = read_touchpad_mode()
+self._update()
+
+def _update(self):
+ Update the label and icon based on the current mode. 
+self._status_text.set_label(STATUS_TEXT[self._mode])
+self._icon.props.icon_name = STATUS_ICON[self._mode]
+
+def toggle_mode(self):
+ On mouse click, toggle the mode. 
+self._mode = TOUCHPAD_MODES[1 - TOUCHPAD_MODES.index(self._mode)]
+write_touchpad_mode(self._mode)
+self._update()
+
+
+def setup(tray):
+ Touchpad palette only appears when the device exisits. 
+if os.path.exists(NODE_PATH):
+tray.add_device(DeviceView())
+
+
+def read_touchpad_mode():
+ Read the touchpad mode from the node path. 
+node_file_handle = open(NODE_PATH, 'r')
+text = 

Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-25 Thread Sascha Silbe
Excerpts from Walter Bender's message of Tue May 18 20:08:58 + 2010:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.
Thanks for working on this!
While at least some users will probably want a faster way (read: a hotkey)
to do this, a Control Panel section is more discoverable and a hotkey
would be better implemented in olpc-kbdshim rather than Sugar.

 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
I'd prefer that code to live in olpc-kbdshim as olpc-utils is specific to
the OLPC builds.

[extensions/cpsection/touchpad/model.py]
 def get_touchpad():
 Get the touchpad mode.
 if path.exists('/home/olpc/.olpc-pentablet-mode'):
Again, this won't work on non-OLPC builds. For this reason I can't test
your patch, sorry.

 def set_touchpad(touchpad):
 Set the touchpad mode.
 if touchpad == _CAPACITIVE:
 system(rm /home/olpc/.olpc-pentablet-mode)
Please use os.remove() instead.

 def print_touchpad():
 Print the future touchpad mode.
 if get_touchpad == _CAPACITIVE:
 print _('Touchpad will be set to finger mode on next reboot.')
Typo: get_touchpad(). But I don't see print_touchpad() used anyway, so
you can just drop it. If you'd like to output this message, please use
logging.info() instead.

[extensions/cpsection/touchpad/view.py]
 _CAPACITIVE = 0
 _RESISTIVE = 1
Please define these constants in a single place only (they are defined in
extensions/cpsection/touchpad/model.py, too). Actually I'd prefer the use
of literal strings instead, that way you don't need to define constants.

 class TouchpadEventIcon(gtk.EventBox):
I suppose TouchpadEventIcon is meant to be used by TouchpadPicker / Touchpad
exclusively. In that case it should be made private, i.e. the name
should be prefixed with an underscore (_TouchpadPicker).

 A subclass of the Sugar Event Icon
Is it? The code says otherwise. ;)
In general, a comment saying A subclass of X isn't useful and can be
left out. Of course a more meaningful description would be even better.

 def __init__(self, **kwargs):
 Create an extra-large, clickable icon.
If rephrased slightly, this is a good candidate for the TouchpadEventIcon
docstring.

 class TouchpadPicker(TouchpadEventIcon):
 A class for the touchpad selection buttons
Like above, A class for is redundant. And what's the difference between
TouchpadEventIcon and TouchpadPicker?

 class Touchpad(SectionView):
[...]
 self._touchpad_label = gtk.HBox(spacing=style.DEFAULT_SPACING)
 self._touchpad_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
 self._touchpad_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
 self._touchpad_alert = None
You can leave out touchpad_ from these names as it's clear from the
context. As the names are now shorter, you can also rename
self._touchpad_label to self._label_box as it only contains the box holding
the label, not the label itself (which will be created later in
_setup_touchpad()).

 def _setup_touchpad(self):
This would probably better be named _setup_widgets(), as it creates a set
of widgets, whereas from the name I'd have expected it to (physically)
configure the touchpad mode.

 def undo(self):
 Undo any changes.
 for widget, handler in self._handlers:
 widget.disconnect(handler)
Do we need to disconnect the handlers manually? Won't PyGTK handle this
for us during garbage collection?
If PyGTK handles it, you can drop self._handlers (and simplify setup()).
Otherwise we should do it in any case, not just in undo().


I've ignored any alert-related code as others have already pointed out
this panel should change the mode at run-time, rather than requiring a
reboot.


PS: Please give git send-email a try. It sends the patches in a way that
makes them easier to review.

Sascha
-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-25 Thread Paul Fox
sascha wrote:
  Excerpts from Walter Bender's message of Tue May 18 20:08:58 + 2010:
   I've attached two patches: (1) a new touchpad section for the control
   panel and (2) new icons for sugar-artwork used by the control panel.
  Thanks for working on this!
  While at least some users will probably want a faster way (read: a hotkey)
  to do this, a Control Panel section is more discoverable and a hotkey
  would be better implemented in olpc-kbdshim rather than Sugar.
  
   We still need a script t be added to olpc-utils that is executed at
   boot time to: (1) change the mode of
   /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
   that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
  I'd prefer that code to live in olpc-kbdshim as olpc-utils is specific to
  the OLPC builds.

the touchpad mode has nothing to do with kbdshim, and vice-versa.

  
  [extensions/cpsection/touchpad/model.py]
   def get_touchpad():
   Get the touchpad mode.
   if path.exists('/home/olpc/.olpc-pentablet-mode'):
  Again, this won't work on non-OLPC builds. For this reason I can't test
  your patch, sorry.

would moving the flag file to a persistent location under /var be
more appropriate?

  
   def set_touchpad(touchpad):
   Set the touchpad mode.
   if touchpad == _CAPACITIVE:
   system(rm /home/olpc/.olpc-pentablet-mode)
  Please use os.remove() instead.
  

i noticed that too.  also, the last version i read still invoked
the touch command -- the touch could change to opening the file
for writing, then closing. 

paul
=-
 paul fox, p...@laptop.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-25 Thread Walter Bender
On Tue, May 25, 2010 at 8:50 AM, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Walter Bender's message of Tue May 18 20:08:58 + 2010:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.
 Thanks for working on this!
 While at least some users will probably want a faster way (read: a hotkey)
 to do this, a Control Panel section is more discoverable and a hotkey
 would be better implemented in olpc-kbdshim rather than Sugar.

 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
 I'd prefer that code to live in olpc-kbdshim as olpc-utils is specific to
 the OLPC builds.

 [extensions/cpsection/touchpad/model.py]
 def get_touchpad():
     Get the touchpad mode.
     if path.exists('/home/olpc/.olpc-pentablet-mode'):
 Again, this won't work on non-OLPC builds. For this reason I can't test
 your patch, sorry.

 def set_touchpad(touchpad):
     Set the touchpad mode.
     if touchpad == _CAPACITIVE:
         system(rm /home/olpc/.olpc-pentablet-mode)
 Please use os.remove() instead.

 def print_touchpad():
     Print the future touchpad mode.
     if get_touchpad == _CAPACITIVE:
         print _('Touchpad will be set to finger mode on next reboot.')
 Typo: get_touchpad(). But I don't see print_touchpad() used anyway, so
 you can just drop it. If you'd like to output this message, please use
 logging.info() instead.

 [extensions/cpsection/touchpad/view.py]
 _CAPACITIVE = 0
 _RESISTIVE = 1
 Please define these constants in a single place only (they are defined in
 extensions/cpsection/touchpad/model.py, too). Actually I'd prefer the use
 of literal strings instead, that way you don't need to define constants.

 class TouchpadEventIcon(gtk.EventBox):
 I suppose TouchpadEventIcon is meant to be used by TouchpadPicker / Touchpad
 exclusively. In that case it should be made private, i.e. the name
 should be prefixed with an underscore (_TouchpadPicker).

     A subclass of the Sugar Event Icon
 Is it? The code says otherwise. ;)
 In general, a comment saying A subclass of X isn't useful and can be
 left out. Of course a more meaningful description would be even better.

     def __init__(self, **kwargs):
         Create an extra-large, clickable icon.
 If rephrased slightly, this is a good candidate for the TouchpadEventIcon
 docstring.

 class TouchpadPicker(TouchpadEventIcon):
     A class for the touchpad selection buttons
 Like above, A class for is redundant. And what's the difference between
 TouchpadEventIcon and TouchpadPicker?

 class Touchpad(SectionView):
 [...]
         self._touchpad_label = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert_box = gtk.HBox(spacing=style.DEFAULT_SPACING)
         self._touchpad_alert = None
 You can leave out touchpad_ from these names as it's clear from the
 context. As the names are now shorter, you can also rename
 self._touchpad_label to self._label_box as it only contains the box holding
 the label, not the label itself (which will be created later in
 _setup_touchpad()).

     def _setup_touchpad(self):
 This would probably better be named _setup_widgets(), as it creates a set
 of widgets, whereas from the name I'd have expected it to (physically)
 configure the touchpad mode.

     def undo(self):
         Undo any changes.
         for widget, handler in self._handlers:
             widget.disconnect(handler)
 Do we need to disconnect the handlers manually? Won't PyGTK handle this
 for us during garbage collection?
 If PyGTK handles it, you can drop self._handlers (and simplify setup()).
 Otherwise we should do it in any case, not just in undo().


 I've ignored any alert-related code as others have already pointed out
 this panel should change the mode at run-time, rather than requiring a
 reboot.


 PS: Please give git send-email a try. It sends the patches in a way that
 makes them easier to review.

 Sascha
 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



Thanks. Great feedback... I'll learn Python one of these days :)

-walter


-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-25 Thread Michael Stone

Sascha wrote:

 PS: Please give git send-email a try. It sends the patches in a way that
 makes them easier to review.

I've never been comfortable with git send-email because it doesn't let me
adequately review the email headers of the messages that are going to be sent
before I hit send.

Instead, what works well for me is to use

   git format-patch ...  mbox

to generate an mbox full of emails which I can hand-edit to my satisfaction (in
my case, in mutt, with 'e') before resending (with mutt, with 'Esc e').

Michael
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-25 Thread James Cameron
On Wed, May 26, 2010 at 12:25:39AM -0400, Michael Stone wrote:
 I've never been comfortable with git send-email because it doesn't let
 me adequately review the email headers of the messages that are going
 to be sent before I hit send.

There are many options for setting header values from command line.  So
far they have met my needs.

But I agree that the mutt resend method is compelling.

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Walter Bender
I've attached two patches: (1) a new touchpad section for the control
panel and (2) new icons for sugar-artwork used by the control panel.

The idea is that on the CL1 OLPC XO 1.0 laptops, we want to give a
choice of either the resistive or capacitive touchpads on the theory
that the resistive touchpad may be easier to use in situations where
the capacitive touchpad is problematic. This patch looks for the
existence of the node /sys/devices/platform/i8042/serio1/ptmode and
will only appear in the Control Panel if this node is present (just
the CL1 version of the XO 1.0).

We still need a script t be added to olpc-utils that is executed at
boot time to: (1) change the mode of
/sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).

I plan to make a few adjustments to the icons (e.g., use the current
XO colors, for example), but wanted to make this version available for
testing ASAP.

enjoy.

-walter

---
Walter Bender
Sugar Labs
http://www.sugarlabs.org
From 96d9a22d2f6d85956a64cfe4c6b92cc3836d7105 Mon Sep 17 00:00:00 2001
From: Walter Bender wal...@sugarlabs.org
Date: Tue, 18 May 2010 15:48:04 -0400
Subject: [PATCH] adding touchpad section to CP

---
 data/icons/Makefile.am|1 +
 data/icons/module-touchpad.svg|   36 ++
 extensions/cpsection/Makefile.am  |2 +-
 extensions/cpsection/touchpad/Makefile.am |6 +
 extensions/cpsection/touchpad/__init__.py |   24 
 extensions/cpsection/touchpad/model.py|   44 +++
 extensions/cpsection/touchpad/view.py |  185 +
 7 files changed, 297 insertions(+), 1 deletions(-)
 create mode 100644 data/icons/module-touchpad.svg
 create mode 100644 extensions/cpsection/touchpad/Makefile.am
 create mode 100644 extensions/cpsection/touchpad/__init__.py
 create mode 100644 extensions/cpsection/touchpad/model.py
 create mode 100644 extensions/cpsection/touchpad/view.py

diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index a35643a..b65b34e 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -10,6 +10,7 @@ sugar_DATA =\
 	module-modemconfiguration.svg	\
 	module-network.svg  \
 	module-power.svg\
+	module-touchpad.svg \
 	module-updater.svg
 
 EXTRA_DIST = $(sugar_DATA)
diff --git a/data/icons/module-touchpad.svg b/data/icons/module-touchpad.svg
new file mode 100644
index 000..5794fd7
--- /dev/null
+++ b/data/icons/module-touchpad.svg
@@ -0,0 +1,36 @@
+?xml version=1.0 encoding=UTF-8 standalone=no?
+!-- Created with Inkscape (http://www.inkscape.org/) --
+
+svg
+   xmlns:svg=http://www.w3.org/2000/svg;
+   xmlns=http://www.w3.org/2000/svg;
+   version=1.1
+   width=55
+   height=55
+   viewBox=0 0 55 55
+   id=Layer_1
+   xml:space=preservedefs
+   id=defs2829 /
+g
+   transform=translate(0,-3.9)
+   id=g2817
+/g
+
+
+
+g
+   transform=translate(0,4.3506441)
+   id=g2928g
+ transform=translate(0,-20)
+ id=g2819
+path
+   d=m 2.934,28.664 0,18.209 49.391,0 0,-18.209 -49.391,0 z M 36,45.833 l -17,0 0,-16.129 17,0 0,16.129 z
+   id=path2821
+   style=fill:#ff;stroke:#66;stroke-width:2 /
+/gpath
+ d=m 46.742465,3.78755 -5.095999,6.747499 -1.044001,1.3585 -1.7375,4.133 c -0.023,0.052 -0.009,0.1115 0.0345,0.1475 0.0445,0.036 0.1055,0.042 0.1535,0.01 l 3.913,-2.5185 c 0.0055,-0.004 0.0055,-0.0135 0.011,-0.0215 0.0325,-0.0245 0.071,-0.046 0.098,-0.081 0.0015,-10e-4 0.017,-0.0205 0.017,-0.0245 l 0.9155,-1.1355 2.7345,-3.527 4.005501,-5.164499 c 0.011,-0.0115 0.0745,-0.1015 0.0745,-0.1015 0.048,-0.0805 0.074,-0.1725 0.074,-0.278 0,-0.0305 0,-0.059 -0.006,-0.088 -0.0435,-0.3815 -0.357501,-0.841 -0.819501,-1.2065 -0.4615,-0.364 -0.9845,-0.5615 -1.364,-0.517 -0.163,0.021 -0.3945,0.1875 -0.3945,0.1875 l -1.5695,2.0795 z
+ id=path2823
+ style=fill:#ff;stroke:#66;stroke-width:1.5 /path
+ d=m 22.817123,44.784359 c 0,0 -3.23492,-8.766448 -3.243008,-9.837791 -0.0135,-1.797291 -2.398098,-2.342156 -2.398098,-2.342156 0,0 -0.621319,-2.249376 0,-2.770053 0.656117,-0.549837 2.934483,-0.629824 3.735004,0.330634 l 2.413094,2.895211 0,-12.75 c 0,0 0.91,-1.589214 1.643962,-1.454545 0.745806,0.133019 1.356038,1.454545 1.356038,1.454545 l 0,10.5 0,-4.5 c 0,0 0.947828,-0.746067 1.5,-0.75 0.552172,-0.0039 1.5,0.75 1.5,0.75 l 0,4.5 0,-3.75 c 0,0 0.675747,-0.758712 1.5,-0.75 0.824253,0.0087 1.5,0.568182 1.5,0.568182 l 0,3.931818 0,-3 c 0,0 0.857274,-0.33549 1.5,-0.375 0.526597,-0.03237 1.448303,0.97351 1.5,1.575 0.220672,2.567514 0.969363,5.350927 0.823983,7.574377 -0.100086,1.53071 -0.67874,8.199778 -2.212713,8.199778 l -11.118262,0 z
+ id=path2825
+ style=fill:#ff;stroke:#66;stroke-width:1.5 //g/svg
\ No newline at end of file
diff --git a/extensions/cpsection/Makefile.am b/extensions/cpsection/Makefile.am
index a92b5dd..4cf1718 100644
--- a/extensions/cpsection/Makefile.am
+++ 

Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Martin Langhoff
On Tue, May 18, 2010 at 4:08 PM, Walter Bender walter.ben...@gmail.com wrote:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.

Bravo! -- any chances can you add a slider control for acceleration?

We're shipping hardcoded values -- being able to change them can help
a lot in deployments.

cheers,


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread forster
Since upgrading to a paraguay build of 0.84, the behaviour of the capacitive 
pad seems to have changed. Rather than infrequent long periods of failure where 
I needed to lick my finger or plug in a mouse, it seems to have shorter periods 
more frequently of raised sensitivity, as if the pad is being periodically 
recalibrated.

It is no longer a problem because the behaviour always clears before it has 
been much of a problem.

Has something been fixed? Is the patch necessary?

Tony




 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.
 
 The idea is that on the CL1 OLPC XO 1.0 laptops, we want to give a
 choice of either the resistive or capacitive touchpads on the theory
 that the resistive touchpad may be easier to use in situations where
 the capacitive touchpad is problematic. This patch looks for the
 existence of the node /sys/devices/platform/i8042/serio1/ptmode and
 will only appear in the Control Panel if this node is present (just
 the CL1 version of the XO 1.0).
 
 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).
 
 I plan to make a few adjustments to the icons (e.g., use the current
 XO colors, for example), but wanted to make this version available for
 testing ASAP.
 
 enjoy.
 
 -walter
 
 ---
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 
 _
 This mail has been virus scanned by Australia On Line
 see http://www.australiaonline.net.au/mailscanning
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Walter Bender
On Tue, May 18, 2010 at 4:53 PM,  fors...@ozonline.com.au wrote:
 Since upgrading to a paraguay build of 0.84, the behaviour of the capacitive 
 pad seems to have changed. Rather than infrequent long periods of failure 
 where I needed to lick my finger or plug in a mouse, it seems to have shorter 
 periods more frequently of raised sensitivity, as if the pad is being 
 periodically recalibrated.

 It is no longer a problem because the behaviour always clears before it has 
 been much of a problem.

 Has something been fixed? Is the patch necessary?

There are still places with dust/humidity conditions where the
flakiness is pretty constant. Having an option to switch to the
resistive pad in those circumstances is something we want to test.


 Tony




 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.

 The idea is that on the CL1 OLPC XO 1.0 laptops, we want to give a
 choice of either the resistive or capacitive touchpads on the theory
 that the resistive touchpad may be easier to use in situations where
 the capacitive touchpad is problematic. This patch looks for the
 existence of the node /sys/devices/platform/i8042/serio1/ptmode and
 will only appear in the Control Panel if this node is present (just
 the CL1 version of the XO 1.0).

 We still need a script t be added to olpc-utils that is executed at
 boot time to: (1) change the mode of
 /sys/devices/platform/i8042/serio1/ptmode to 666; and (2) write a 1 to
 that node if a flag file exists (/home/olpc/.olpc-pentablet-mode).

 I plan to make a few adjustments to the icons (e.g., use the current
 XO colors, for example), but wanted to make this version available for
 testing ASAP.

 enjoy.

 -walter

 ---
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org

 _
 This mail has been virus scanned by Australia On Line
 see http://www.australiaonline.net.au/mailscanning
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel





-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Paul Fox
fors...@ozonline.com.au wrote:
  Since upgrading to a paraguay build of 0.84, the behaviour of the capacitive 
  pad seems to have changed. Rather than infrequent long periods of failure 
  where 
  I needed to lick my finger or plug in a mouse, it seems to have shorter 
  periods 
  more frequently of raised sensitivity, as if the pad is being periodically 
  recalibrated.
  
  It is no longer a problem because the behaviour always clears before it has 
  been much of a problem.
  
  Has something been fixed? Is the patch necessary?

yes, the touchpad driver was revised to try and detect bad
behavior more quickly, and correct it when necessary, but not
too often.  thanks for noticing.  :-)
( http://wiki.laptop.org/go/Touchpad_driver_changes )

that being said, since we also have this alternate mode for the
pad, we should make it available.  it's far from perfect -- it
requires a stylus, for instance, and a fair amount of pressure.
but it's predictable, which is something you can't really say for
capacitive mode.

paul
=-
 paul fox, p...@laptop.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Walter Bender
On Tue, May 18, 2010 at 4:50 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
 On Tue, May 18, 2010 at 4:08 PM, Walter Bender walter.ben...@gmail.com 
 wrote:
 I've attached two patches: (1) a new touchpad section for the control
 panel and (2) new icons for sugar-artwork used by the control panel.

 Bravo! -- any chances can you add a slider control for acceleration?

 We're shipping hardcoded values -- being able to change them can help
 a lot in deployments.

I could add a slider, but I don't know anything about the values I
should be outputing or where I should be outputing them...

-walter


 cheers,


 m
 --
  martin.langh...@gmail.com
  mar...@laptop.org -- School Server Architect
  - ask interesting questions
  - don't get distracted with shiny stuff  - working code first
  - http://wiki.laptop.org/go/User:Martinlanghoff




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] touchpad section for Sugar Control Panel

2010-05-18 Thread Paul Fox
martin wrote:
  On Tue, May 18, 2010 at 4:08 PM, Walter Bender walter.ben...@gmail.com 
  wrote:
   I've attached two patches: (1) a new touchpad section for the control
   panel and (2) new icons for sugar-artwork used by the control panel.
  
  Bravo! -- any chances can you add a slider control for acceleration?
  
  We're shipping hardcoded values -- being able to change them can help
  a lot in deployments.


are we sure that adjusting acceleration is as important with an
f11 release?  i have the impression that the default algorithm is
quite a bit better than the old one, and doesn't need the
adjustment as much.  i confess i haven't used a recent XO-1
release extensively, but i'd rather not see us add controls where
none is needed.

anyway, according to a recent xset man page, values of $N between
30 and 40 in xset m $N/20 0 are recommended (the man page
actually says between 3/2 and 2).  a slider might want a little
more range than that, but not much.  and as with the pentablet
setting, there needs to be a way to re-init this at session
startup, and a way for the slider to learn the current value directly
from X (perhaps via xset, or perhaps more directly).

paul
=-
 paul fox, p...@laptop.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel