Ejemplo n.º 1
0
def storyPicker(parent,name,value):
  global picklist
  global stories
  picklist = common.csplit(str(value))
  title = "Stories involving %s" % name
  if not len(stories):
    stories = myStories(config.get("realmdir"))
  askbox = gtk.Dialog(title,parent,gtk.DIALOG_DESTROY_WITH_PARENT,None)
  askbox.add_button("Cancel",1)
  askbox.add_button("Set",0)
  for key in sorted(stories.keys()):
    title = stories.get(key,"")
    if title and len(title) > 0:
      button = gtk.CheckButton(title)
      button.show()
      button.unset_flags(gtk.CAN_FOCUS)
      button.connect("toggled",updatePicklist,key)
      if not picklist: picklist = []
      if key in picklist:
        button.set_active(True)
      askbox.vbox.pack_start(button,True,True,2)
# OK button closes dialog, turns keys into a csv string and returns it (nondefined values, plus defined that are checked)
  askbox.move(config['pos'][0] + 50,config['pos'][1] + 50)
  value = askbox.run()
  askbox.destroy()
  if value == 0:
    output = ""
    for k in range(len(picklist)):
      if k > 0:
        output += ", "
      output += picklist[k]
    return output
  else:
    status.push(0,"Cancel: Stories not modified.")
  return None
Ejemplo n.º 2
0
def setStory(widget,event,key):
  global stories
  if stories.get(key) != widget.get_text():
    stories[key] = widget.get_text()
    widget.modify_base(gtk.STATE_NORMAL,gtk.gdk.color_parse("#CCFFCC")) # change background for edited