[Add] resedit: remove/add hyperspace paths.

This commit is contained in:
Allanis 2013-04-13 19:56:48 +01:00
parent 34b306bf1b
commit 0d5a1c6517
4 changed files with 35 additions and 1 deletions

View File

@ -1,6 +1,13 @@
#!/usr/bin/env python
from xml.dom import minidom
import sets
def uniq(alist): # Fastest order preserving.
s = sets.Set(alist)
del alist[:]
for a in s:
alist.append(a)
def load(xmlfile, tag, has_name=True, do_array=None):
dom = minidom.parse(xmlfile)

Binary file not shown.

View File

@ -51,7 +51,9 @@ class space:
"butSave":["clicked",self.saveSystems],
"butZoomIn":["clicked", self.__space_zoomin],
"butZoomOut":["clicked", self.__space_zoomout],
"butReset":["clicked", self.__space_reset]
"butReset":["clicked", self.__space_reset],
"butAddJump":["clicked", self.__jump_add],
"butRmJump":["clicked", self.__jump_rm]
}
for key, val in hooks.items():
self.__swidget(key).connect(val[0], val[1])
@ -336,6 +338,31 @@ class space:
layout = area.create_pango_layout(sys_name)
area.window.draw_layout(gc, dx+r/2+2, dy-r/2, layout)
def __jump_add(self, wgt=None, event=None):
if self.space_sel in self.systems.keys() and self.cur_system in self.systems.keys():
self.systems[self.cur_system]["jumps"].append(self.space_sel)
self.systems[self.space_sel]["jumps"].append(self.cur_system)
data.uniq(self.systems[self.cur_system]["jumps"])
data.uniq(self.systems[self.space_sel]["jumps"])
self.__update()
self.__space_draw()
def __jump_rm(self, wgt=None, event=None):
if self.space_sel in self.systems.keys() and self.cur_system in self.systems.keys():
i = 0
for e in self.systems[self.cur_system]["jumps"]:
if e == self.space_sel:
self.systems[self.cur_system]["jumps"].pop(i)
i = i + 1
i = 0
for e in self.systems[self.space_sel]["jumps"]:
if e == self.cur_system:
self.systems[self.space_sel]["jumps"].pop(i)
i = i + 1
self.__update()
self.__space_draw()
def debug(self):
print "SYSTEMS LOADED:"
print self.systems

Binary file not shown.