changeset: 2752:bce3b2614bd5
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Wed Jun 30 23:12:41 2010 -0400
files: alternative_wmiircs/python/pygmi/fs.py
description:
[python] Fix rather badly broken pygmi.
diff -r 90c1abaf8ba9 -r bce3b2614bd5 alternative_wmiircs/python/pygmi/fs.py
--- a/alternative_wmiircs/python/pygmi/fs.py Wed Jun 30 00:58:04 2010 -0400
+++ b/alternative_wmiircs/python/pygmi/fs.py Wed Jun 30 23:12:41 2010 -0400
@@ -49,6 +49,8 @@
return (v for v in self.cls.all(*self.args))
def iteritems(self):
return ((v, self.cls(*(self.args + (v,)))) for v in self.cls.all(*self.args))
+ def itervalues(self):
+ return (self.cls(*(self.args + (v,))) for v in self.cls.all(*self.args))
class Ctl(object):
"""
@@ -68,6 +70,8 @@
sentinel = {}
ctl_types = {}
ctl_hasid = False
+ ctl_open = 'aopen'
+ ctl_file = None
def __eq__(self, other):
if self.ctl_hasid and isinstance(other, Ctl) and other.ctl_hasid:
@@ -82,12 +86,14 @@
Arguments are joined by ascii spaces and written to the ctl file.
"""
def next(file, exc=None, tb=None):
+ if exc:
+ print exc
if file:
- self.file = file
+ self.ctl_file = file
file.awrite(u' '.join(map(unicode, args)))
- if self.file:
- return next(file)
- client.acreate(self.ctl_path, callback=next, mode=OWRITE)
+ if self.ctl_file:
+ return next(self.ctl_file)
+ getattr(client, self.ctl_open)(self.ctl_path, callback=next, mode=OWRITE)
def __getitem__(self, key):
for line in self.ctl_lines():
@@ -560,6 +566,7 @@
ctl_types = {
'colors': (Colors.from_string, lambda c: str(Colors(*c))),
}
+ ctl_open = 'acreate'
colors = Dir.ctl_property('colors')
label = Dir.ctl_property('label')
@@ -590,7 +597,7 @@
@property
def exists(self):
- return bool(self.file and File.stat(self.file))
+ return bool(self.file.stat() if self.file else client.stat(self.ctl_path))
@classmethod
def all(cls, side):
@@ -764,8 +771,8 @@
self.focuscol = focuscol
self.lastselect = datetime.now()
for t in wmii.tags:
- self.add(t.id)
- for b in wmii.lbuttons:
+ self.add(t)
+ for b in wmii.lbuttons.itervalues():
if b.name not in self.tags:
b.remove()
self.focus(Tag('sel').id)
Received on Thu Jul 01 2010 - 03:12:54 UTC
This archive was generated by hypermail 2.2.0 : Thu Jul 01 2010 - 03:24:04 UTC