added volume plugin icons

fixed small bugs in error output
fixed some subprocess.communicate mistakes
fixed display bug in partition plugin
This commit is contained in:
lars 2006-11-03 14:27:55 +00:00
parent 2d7b34afaa
commit 5846c3b0f8
15 changed files with 16 additions and 16 deletions

View file

@ -64,6 +64,6 @@ class date(CryptoBoxPlugin.CryptoBoxPlugin):
"plugin", "plugin",
os.path.join(self.pluginDir, "root_action.py"), os.path.join(self.pluginDir, "root_action.py"),
date]) date])
proc.communicate() proc.wait()
return proc.returncode == 0 return proc.returncode == 0

View file

@ -31,6 +31,6 @@ if __name__ == "__main__":
shell = False, shell = False,
stdout = subprocess.PIPE, stdout = subprocess.PIPE,
args = [DATE_BIN, args[0]]) args = [DATE_BIN, args[0]])
proc.communicate() proc.wait()
sys.exit(proc.returncode) sys.exit(proc.returncode)

View file

@ -11,7 +11,7 @@
<?cs else ?> <?cs else ?>
<?cs # we use "loop" instead of "each" to keep the order of the disks ?> <?cs # we use "loop" instead of "each" to keep the order of the disks ?>
<?cs loop: index = #0, subcount(Data.Disks)-1, #1 ?> <?cs loop: index = #0, subcount(Data.Disks)-1, #1 ?>
<?cs call:show_volume(index) ?> <?cs call:show_volume(Data.Disks[index]) ?>
<?cs /loop ?> <?cs /loop ?>
<?cs /if ?> <?cs /if ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -84,7 +84,7 @@ class network(CryptoBoxPlugin.CryptoBoxPlugin):
args = [ args = [
root_action_plug.IFCONFIG_BIN, root_action_plug.IFCONFIG_BIN,
root_action_plug.IFACE]) root_action_plug.IFACE])
(output, error) = proc.communicate() proc.wait()
if proc.returncode != 0: return (0,0,0,0) if proc.returncode != 0: return (0,0,0,0)
## this regex matches the four numbers of the IP ## this regex matches the four numbers of the IP
match = re.search(u'inet [\w]+:(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\s',output) match = re.search(u'inet [\w]+:(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\s',output)
@ -110,7 +110,7 @@ class network(CryptoBoxPlugin.CryptoBoxPlugin):
"plugin", "plugin",
os.path.join(self.pluginDir, "root_action.py"), os.path.join(self.pluginDir, "root_action.py"),
ip]) ip])
proc.communicate() proc.wait()
if proc.returncode != 0: if proc.returncode != 0:
self.cbox.log.warn("failed to change IP address: %s" % ip) self.cbox.log.warn("failed to change IP address: %s" % ip)
self.cbox.log.warn("error output: %s" % str(proc.stderr.read())) self.cbox.log.warn("error output: %s" % str(proc.stderr.read()))

View file

@ -36,6 +36,6 @@ if __name__ == "__main__":
proc = subprocess.Popen( proc = subprocess.Popen(
shell = False, shell = False,
args = [IFCONFIG_BIN, IFACE, args[0]]) args = [IFCONFIG_BIN, IFACE, args[0]])
proc.communicate() proc.wait()
sys.exit(proc.returncode) sys.exit(proc.returncode)

View file

@ -21,7 +21,7 @@ def __partitionDevice(device):
SFDISK_BIN, SFDISK_BIN,
"-uM", "-uM",
device]) device])
proc.communicate() proc.wait()
return proc.returncode == 0 return proc.returncode == 0
@ -38,7 +38,7 @@ def __formatPartition(device, type):
MKFS_BIN, MKFS_BIN,
"-t", type, "-t", type,
device]) device])
proc.communicate() proc.wait()
## TODO: very ugly way of communication: it assumes, that failures are fast - success is slow ## TODO: very ugly way of communication: it assumes, that failures are fast - success is slow
if proc.returncode == 0: if proc.returncode == 0:
time.sleep(1) time.sleep(1)
@ -57,7 +57,7 @@ def __labelPartition(device, label):
LABEL_BIN, LABEL_BIN,
device, device,
label]) label])
proc.communicate() proc.wait()
return proc.returncode == 0 return proc.returncode == 0

View file

@ -8,7 +8,7 @@
<div align="center"> <div align="center">
<table class="partition"> <table class="partition">
<?cs if:Data.Plugins.partition.availSize > 0 ?> <?cs if:(Data.Plugins.partition.availSize > 0) || (subcount(Data.Plugins.partition.Parts) > 0) ?>
<?cs # no table header if the harddisk is not partitionable (e.g. still active) ?> <?cs # no table header if the harddisk is not partitionable (e.g. still active) ?>
<tr> <tr>
<th><?cs var:html_escape(Lang.Plugins.partition.Text.PartNum) ?></th> <th><?cs var:html_escape(Lang.Plugins.partition.Text.PartNum) ?></th>

View file

@ -16,7 +16,7 @@ def call_prog(progy):
proc = subprocess.Popen( proc = subprocess.Popen(
shell = False, shell = False,
args = [progy]) args = [progy])
proc.communicate() proc.wait()
return proc.returncode == 0 return proc.returncode == 0

View file

@ -46,6 +46,6 @@ class shutdown(CryptoBoxPlugin.CryptoBoxPlugin):
"plugin", "plugin",
os.path.join(self.pluginDir, "root_action.py"), os.path.join(self.pluginDir, "root_action.py"),
action]) action])
proc.communicate() proc.wait()
return proc.returncode == 0 return proc.returncode == 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,5 +1,5 @@
Name = Mount and umount volumes Name = Mount and umount volumes
Link = Main Link = Activation
Title { Title {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -37,7 +37,7 @@ class volume_mount(CryptoBoxPlugin.CryptoBoxPlugin):
def __doMountPlain(self): def __doMountPlain(self):
if self.container.isMounted(): if self.container.isMounted():
self.hdf["Data.Warning"] = "Plugins.volume_mount.IsAlreadyMounted" self.hdf["Data.Warning"] = "Plugins.volume_mount.IsAlreadyMounted"
self.cbox.log.info("the device (%s) is already mounted" % device) self.cbox.log.info("the device (%s) is already mounted" % self.device)
return "volume_status" return "volume_status"
if self.container.getType() != self.container.Types["plain"]: if self.container.getType() != self.container.Types["plain"]:
## not a plain container - fail silently ## not a plain container - fail silently
@ -61,11 +61,11 @@ class volume_mount(CryptoBoxPlugin.CryptoBoxPlugin):
def __doMountLuks(self, pw): def __doMountLuks(self, pw):
if self.container.isMounted(): if self.container.isMounted():
self.hdf["Data.Warning"] = "Plugins.volume_mount.IsAlreadyMounted" self.hdf["Data.Warning"] = "Plugins.volume_mount.IsAlreadyMounted"
self.cbox.log.info("the device (%s) is already mounted" % device) self.cbox.log.info("the device (%s) is already mounted" % self.device)
return "volume_status" return "volume_status"
if not pw: if not pw:
self.dataset["Data.Warning"] = "EmptyPassword" self.dataset["Data.Warning"] = "EmptyPassword"
self.log.info("no password was supplied for mounting of device: '%s'" % device) self.log.info("no password was supplied for mounting of device: '%s'" % self.device)
return "volume_status" return "volume_status"
if self.container.getType() != self.container.Types["luks"]: if self.container.getType() != self.container.Types["luks"]:
## not a luks container - fail silently ## not a luks container - fail silently

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB