示例#1
0
文件: city.py 项目: over2sd/minette
def packPlace(box, scroll, data, cityf, placef, value, tabs, newplace, ar, ctalts):
    row = gtk.HBox()
    row.show()
    note = ""
    x = getInf(data, ["info", "places"], {})
    if x.get(placef) is not None:
        note = getInf(x, [placef, "note"], "")
    plbut = gtk.Button(value)
    plentry = gtk.Entry()
    plbut.show()
    plentry.show()
    plbut.set_size_request(100, 12)
    plbut.connect("clicked", displayPlace, placef, tabs)
    row.pack_start(plbut, 1, 1, 2)
    label = gtk.Label("Note:")
    label.show()
    row.pack_start(label, 0, 0, 2)
    row.pack_start(plentry, 1, 1, 2)
    plentry.set_text(note)
    activateInfoEntry(plentry, ar, ctalts, scroll, data, cityf, "places", 2, [placef, "note"])
    if newplace:
        markChanged(plentry, "c", [cityf, "info", "places", placef, "note"], ctalts, ar)
    killbut = gtk.Button("Unregister")
    killbut.show()
    image = gtk.Image()
    image.show()
    image.set_from_file("img/subtract.png")
    killbut.set_image(image)
    killbut.connect("clicked", unlinkPlace, row, cityf, placef)
    row.pack_start(killbut, 0, 0, 1)
    box.pack_start(row, 0, 0, 1)
示例#2
0
文件: state.py 项目: over2sd/minette
def packCity(box,scroll,data,statef,cityf,value,tabs,newcity,ar,stalts):
  row = gtk.HBox()
  row.show()
  note = ""
  x = getInf(data,["info","cities"],{})
  if x.get(cityf) is not None: note = getInf(x,[cityf,"note"],"")
  cbut = gtk.Button(value)
  centry = gtk.Entry()
  cbut.show()
  centry.show()
  cbut.set_size_request(100,12)
  cbut.connect("clicked",displayCity,cityf,tabs)
  row.pack_start(cbut,1,1,2)
  label = gtk.Label("Note:")
  label.show()
  row.pack_start(label,0,0,2)
  row.pack_start(centry,1,1,2)
  centry.set_text(note)
  activateInfoEntry(centry,ar,stalts,scroll,data,statef,"cities",2,[cityf,"note"])
  if newcity: markChanged(centry,'s',[statef,"info","cities",cityf,"note"],stalts,ar)
  killbut = gtk.Button("Unregister")
  killbut.show()
  image = gtk.Image()
  image.show()
  image.set_from_file("img/subtract.png")
  killbut.set_image(image)
  killbut.connect("clicked",unlinkCity,row,statef,cityf)
  row.pack_start(killbut,0,0,1)
  box.pack_start(row,0,0,1)
示例#3
0
文件: city.py 项目: over2sd/minette
def buildStateRow(scroll, data, fileid):
    row = gtk.HBox()
    row.show()
    label = gtk.Label("State:")
    label.show()
    row.pack_start(label, False, False, 2)
    label.set_width_chars(20)
    label.set_alignment(1, 0.5)
    choices = getStateList()
    path = ["info", "state"]
    g = getInf(data, path)
    #  loc = gtk.ComboBoxText()
    loc = gtk.combo_box_new_text()
    loc.show()
    selected = -1
    keys = []
    i = 0
    for key in sorted(choices.keys()):
        loc.append_text("%s" % choices[key])
        keys.append(key)
        if g == key or g == choices[key]:
            selected = i
        i += 1
    loc.set_active(selected)
    loc.connect("changed", setStateCombo, fileid)
    loc.connect("focus", scrollOnTab, scroll)
    loc.connect("focus-in-event", scrollOnTab, scroll)
    row.pack_start(loc, True, True, 2)
    if len(g) and selected == -1:
        value = gtk.Label(" %s " % g)
        value.show()
        row.pack_start(value, True, True, 2)
    return row
示例#4
0
文件: place.py 项目: over2sd/minette
def buildLocRow(data,fileid):
  row = gtk.HBox()
  row.show()
  label = gtk.Label("Location:")
  label.show()
  row.pack_start(label,False,False,2)
  label.set_width_chars(20)
  label.set_alignment(1,0.5)
  choices = getCityList()
  loc = gtk.Label()
  loc.show()
  row.pack_start(loc,True,True,2)
  g = getInf(data,["info","loc"])
  h = getInf(data,["info","state"])
  loc.set_text("%s, %s" % (g,h))
  addLocButton(row,1,entry=loc,cat='l',city="loc",cityfile="locfile",state="state",statefile="statefile",data=data)
  return row
示例#5
0
文件: person.py 项目: over2sd/minette
def isOrderRev(fileid):
  global config
  norm = "gf"
  if config['familyfirst']: norm = "fg"
  value = getInf(people.get(fileid),["info","nameorder"])
  if value == norm or not value:
    return False
  else:
    return True
示例#6
0
def getPlacesIn(city):
  state = common.getInf(cities.get(city),["info","statefile"],None)
  if state.find(".xml") > -1: state = state.split('.')[0]
  if city.find(".xml") > -1: city = city.split('.')[0]
  if state:
    data = placeList.get(state)
    if data is not None:
      data = placeList[state].get(city)
      if data is not None:
        return data
      else:
        common.say("City %s not found in placeList" %city)
    else:
      common.say("State %s not found in placeList" % state)
  return {}
示例#7
0
文件: person.py 项目: over2sd/minette
def buildGenderRow(scroll,data,fileid,ar,alts,display = 0):
  row = gtk.HBox()
  row.show()
  label = gtk.Label("Gender:")
  label.show()
  label
  row.pack_start(label,False,False,2)
  label.set_width_chars(20)
  label.set_alignment(1,0.5)
  choices = allGenders()
  path = ["info","gender"]
  g = getInf(data,path)
  if display == 1:
    radio = gtk.VBox()
    radio.show()
    row.pack_start(radio,True,True,2)
    group = None
    for key in sorted(choices.keys()):
      rbut = gtk.RadioButton(group,choices[key])
      rbut.connect("clicked",setGender,fileid,key,ar,alts)
      if config['debug'] > 5: print "%s : %s : %s" % (g,key,choices[key])
      if g == key or g == choices[key]:
        rbut.set_active(True)
      rbut.show()
      group = rbut
      radio.pack_start(rbut,False,False,2)
  else:
#    gender = gtk.ComboBoxText()
    gender = gtk.combo_box_new_text()
    gender.show()
    selected = -1
    keys = []
    i = 0
    for key in sorted(choices.keys()):
      gender.append_text(choices[key])
      keys.append(key)
      if g == key or g == choices[key]:
        selected = i
      i += 1
    gender.set_active(selected)
    gender.connect("changed",setGenderCombo,None,fileid,ar,alts) # move-action sends an event, so must fill its place when change sends without one
    gender.connect("move-active",setGenderCombo,fileid,ar,alts)
    gender.connect("focus",scrollOnTab,scroll)
    gender.connect("focus-in-event",scrollOnTab,scroll)
    row.pack_start(gender,True,True,2)
  return row
示例#8
0
文件: city.py 项目: over2sd/minette
def initCinfo(self, fileid, tabs, ar, ctalts):
    data = {}
    scroll = self.get_parent()
    try:
        data = cities.get(fileid)
    except KeyError as e:
        print "initCinfo: An error occurred accessing %s: %s" % (fileid, e)
        return
    scroll = self.get_parent()
    label = gtk.Label("City:")
    label.set_alignment(0, 0)
    label.show()
    self.pack_start(label, 0, 0, 1)
    self.s1 = gtk.HSeparator()
    self.pack_start(self.s1, False, False, 2)
    self.s1.show()
    name = buildarow(scroll, "Name:", data, fileid, "name", ar, ctalts)
    self.pack_start(name, 0, 0, 2)
    state = buildStateRow(scroll, data, fileid)
    self.pack_start(state, 0, 0, 2)
    row = gtk.HBox()
    row.show()
    path = ["info", "start"]
    label = gtk.Label("Start Date:")
    label.show()
    row.pack_start(label, False, False, 2)
    start = gtk.Entry(25)
    start.show()
    start.set_text(getInf(data, path))
    activateInfoEntry(start, ar, ctalts, scroll, data, fileid, "start")
    row.pack_start(start, True, True, 2)
    path2 = [fileid, "info"]
    path2.append(path[-1])
    placeCalendarButton(data, row, start, path2, ctalts, counter=ar)
    label = gtk.Label("Cue:")
    label.show()
    row.pack_start(label, False, False, 2)
    scue = gtk.Entry(25)
    scue.show()
    path[1] = "scue"
    scue.set_text(getInf(data, path))
    activateInfoEntry(scue, ar, ctalts, scroll, data, fileid, "scue")
    row.pack_start(scue, True, True, 2)
    self.pack_start(row, False, False, 2)
    row = gtk.HBox()
    row.show()
    label = gtk.Label("End Date:")
    label.show()
    row.pack_start(label, False, False, 2)
    end = gtk.Entry(25)
    end.show()
    path[1] = "end"
    end.set_text(getInf(data, path))
    activateInfoEntry(end, ar, ctalts, scroll, data, fileid, "end")
    row.pack_start(end, True, True, 2)
    path2 = [fileid, "info"]
    path2.append(path[-1])
    placeCalendarButton(data, row, end, path2, ctalts, counter=ar)
    label = gtk.Label("Cue:")
    label.show()
    row.pack_start(label, False, False, 2)
    ecue = gtk.Entry(25)
    ecue.show()
    path[1] = "ecue"
    ecue.set_text(getInf(data, path))
    activateInfoEntry(ecue, ar, ctalts, scroll, data, fileid, "ecue")
    row.pack_start(ecue, True, True, 2)
    self.pack_start(row, False, False, 2)
    self.aspects = buildaspectrow(scroll, cities.get(fileid), fileid, ar, ctalts)  # ,display = 0)
    self.add(self.aspects)
    """
	Population
	Major products/industries
	Major landmarks (list?)
	Primary power
	Secondary powers
	Demographics/Main race
	Districts (notebox)
	History?
"""
    self.notebox = gtk.VBox()
    self.notebox.show()
    self.pack_start(self.notebox, True, False, 2)
    label = gtk.Label("Places")
    label.set_alignment(0, 0)
    label.show()
    self.notebox.pack_start(label, 0, 0, 1)
    s1 = gtk.HSeparator()
    self.notebox.pack_start(s1, False, False, 2)
    s1.show()
    box = gtk.HBox()
    box.show()
    addbut = gtk.Button("Register Place")
    image = gtk.Image()
    image.set_from_file("img/add.png")
    image.show()
    addbut.set_image(image)
    addbut.show()
    path = ["info", "places"]
    state = validateFileid(getInf(data, ["info", "statefile"], ""))
    cityname = getInf(data, ["info", "name"], "")
    cityplaces = getInf(data, path, {})
    for l in cityplaces.keys():
        fi = l
        name = getInf(cityplaces, [l, "name"], "")
        pushLoc(state, "", fileid, cityname, fi, name)
    lbook = getPlacesIn(fileid)
    addbut.connect(
        "clicked", choosePlace, self.notebox, tabs, scroll, data, fileid, ar, ctalts, "Register in %s..." % cityname
    )
    box.pack_end(addbut, False, False, 1)
    self.notebox.pack_start(box, False, False, 1)
    for l in sorted(lbook.keys()):
        if l != "_name":
            newplace = False
            if l not in cityplaces.keys():
                newplace = True
                pushPlace(fileid, l, lbook[l])
            packPlace(self.notebox, scroll, data, fileid, l, lbook[l], tabs, newplace)
    el = gtk.Label("End of record")
    el.show()
    el.set_alignment(1, 1)
    self.pack_start(el, 0, 0, 3)
示例#9
0
文件: place.py 项目: over2sd/minette
def initLinfo(self, fileid,ar,plalts):
  data = {}
  scroll = self.get_parent()
  try:
    data = places.get(fileid)
  except KeyError as e:
    print "initLinfo: An error occurred accessing %s: %s" % (fileid,e)
    return
  scroll = self.get_parent()
  self.namelabelbox = gtk.HBox()
  self.namelabelbox.show()
  label = gtk.Label("Place:")
  label.set_alignment(0,0)
  label.show()
  self.namelabelbox.pack_start(label,1,1,2)
  self.pack_start(self.namelabelbox)
  self.s1 = gtk.HSeparator()
  self.pack_start(self.s1,False,False,2)
  self.s1.show()
  name = buildarow(scroll,"Name:",data,fileid,'name',ar,plalts)
  self.pack_start(name,0,0,2)
  commonname = buildarow(scroll,"Common Name:",data,fileid,'commonname',ar,plalts)
  self.pack_start(commonname,0,0,2)
  if commonname.e.get_text() == "" and name.e.get_text() != "":
    commonname.e.set_text(name.e.get_text())
    commonname.e.emit("focus-out-event",gtk.gdk.Event(gtk.gdk.FOCUS_CHANGE))
  row = gtk.HBox()
  row.show()
  path = ["info","start"]
  label = gtk.Label("Start Date:")
  label.show()
  row.pack_start(label,False,False,2)
  start = gtk.Entry(25)
  start.show()
  start.set_text(getInf(data,path))
  activateInfoEntry(start,ar,plalts,scroll,data,fileid,"start")
  row.pack_start(start,True,True,2)
  path2 = [fileid,"info"]
  path2.append(path[-1])
  placeCalendarButton(data,row,start,path2,plalts,counter=ar)
  label = gtk.Label("Cue:")
  label.show()
  row.pack_start(label,False,False,2)
  scue = gtk.Entry(25)
  scue.show()
  path[1] = "scue"
  scue.set_text(getInf(data,path))
  activateInfoEntry(scue,ar,plalts,scroll,data,fileid,"scue")
  row.pack_start(scue,True,True,2)
  self.pack_start(row,False,False,2)
  row = gtk.HBox()
  row.show()
  label = gtk.Label("End Date:")
  label.show()
  row.pack_start(label,False,False,2)
  end = gtk.Entry(25)
  end.show()
  path[1] = "end"
  end.set_text(getInf(data,path))
  activateInfoEntry(end,ar,plalts,scroll,data,fileid,"end")
  row.pack_start(end,True,True,2)
  path2 = [fileid,"info"]
  path2.append(path[-1])
  placeCalendarButton(data,row,end,path2,plalts,counter=ar)
  label = gtk.Label("Cue:")
  label.show()
  row.pack_start(label,False,False,2)
  ecue = gtk.Entry(25)
  ecue.show()
  path[1] = "ecue"
  ecue.set_text(getInf(data,path))
  activateInfoEntry(ecue,ar,plalts,scroll,data,fileid,"ecue")
  row.pack_start(ecue,True,True,2)
  self.pack_start(row,False,False,2)
  self.aspects = buildaspectrow(scroll,places.get(fileid),fileid,ar,plalts) # ,display = 0)
  self.add(self.aspects)
  label = gtk.Label("Stories")
  label.set_alignment(0,0)
  label.show()
  self.pack_start(label,False,False,2)
  self.s1 = gtk.HSeparator()
  self.pack_start(self.s1,False,False,2)
  self.s1.show()
  self.stories = buildarow(scroll,"Stories:",data,fileid,'stories',ar,plalts,2)
  self.pack_start(self.stories,False,False,2)
  self.mention = buildarow(scroll,"First Mentions:",data,fileid,'mention',ar,plalts)
  self.pack_start(self.mention,False,False,2)
  self.l7 = gtk.Label("Specifications")
  self.l7.set_alignment(0,1)
  self.l7.show()
  self.pack_start(self.l7,False,False,2)
  self.s2 = gtk.HSeparator()
  self.pack_start(self.s2,False,False,2)
  self.s2.show()
  self.desc = buildarow(scroll,"Description:",data,fileid,'desc',ar,plalts)
  self.pack_start(self.desc,False,False,2)
  self.address = buildarow(scroll,"Address:",data,fileid,'address',ar,plalts)
  self.pack_start(self.address,False,False,2)
  self.location = buildLocRow(data,fileid)
  self.pack_start(self.location,False,False,2)
  label = gtk.Label("Notes")
  label.set_alignment(0,0)
  label.show()
  self.pack_start(label,False,False,2)
  self.s1 = gtk.HSeparator()
  self.pack_start(self.s1,False,False,2)
  self.s1.show()
  notebox = gtk.VBox()
  notebox.show()
  self.pack_start(notebox,True,True,2)
  newbut = gtk.Button("Add a note")
  newbut.show()
  image = gtk.Image()
  image.set_from_file("img/add.png")
  newbut.set_image(image)
  newbut.connect("clicked",addNote,scroll,ar,plalts,notebox,fileid)
  box = gtk.HBox()
  box.show()
  box.pack_end(newbut,0,0,2)
  label = gtk.Label("Date")
  label.show()
  box.pack_end(label,0,0,2)
  label = gtk.Label("Note")
  label.show()
  box.pack_end(label,1,1,2)
  notebox.pack_start(box,0,0,2)
  notes = data.get("info")
  if notes: notes = notes.get("notes")
  if notes:
    for i in sorted(notes.keys()):
      dval = notes[i].get("date")
      cval = notes[i].get("content")
      if dval: dval = dval[0]
      if cval: cval = cval[0]
      if dval and cval: addNote(self,scroll,notebox,fileid,dval,cval,i)
  el = gtk.Label("End of record")
  el.show()
  el.set_alignment(1,1)
  self.pack_start(el,0,0,3)
示例#10
0
文件: person.py 项目: over2sd/minette
def listRel(self,r,fileid,relid,scroll,psalts,target = None):
  if not r.get("related"): return
  name = r['related'][0]
  if not r.get("cat"):
    print "empty category! Attempting to find...",
    x = getCat(relid)
    if x is not None:
      r['cat'] = x
      print r
    else:
      print "Not found!\nTo repair, open %s manually, and then reload %s." % (relid,fileid)
      return
    print '\n',
  cat = r['cat'][0]
  displayFunc = None
  if cat == "person":  displayFunc = displayPerson
  elif cat == "place": displayFunc = place.displayPlace
  else:
    print "Invalid category '%s' at listRel:%d!" % (cat,lineno())
    return
  if not target: target = self.get_parent().get_parent().get_parent().get_parent() #Which is better?
  namebutton = gtk.Button(relid)
  namebutton.connect("clicked",displayFunc,relid,target) # passing the target or figuring it from parentage?
  ### TODO: displayPerson? what about places/orgs?
  row1 = gtk.HBox()
  self.pack_start(row1,0,0,2)
  row1.pack_start(namebutton,1,1,2)
  row1.show()
  namebutton.show()
  namebutton.set_alignment(0.75,0.05)
  namebutton.set_size_request(int(self.size_request()[0] * 0.20),10)
  namelabel = gtk.Label("Name: ")
  namelabel.show()
  row1.pack_start(namelabel,0,0,2)
  namelabel.set_width_chars(6)
  nameentry = gtk.Entry()
  nameentry.show()
  nameentry.set_text(name)
  activateRelEntry(nameentry,psalts,scroll,people.get(fileid),fileid,relid,"related")
  row1.pack_start(nameentry,1,1)
  txt = r.get("relation")
  if txt is None:
    r['relation'] = ["",False]
    txt = ["",False]
  relation = gtk.Label(txt[0])
  relation.show()
  relation.set_width_chars(8)
  row1.pack_start(relation,1,1)
  relset = gtk.Button("Set")
  relset.show()
  relset.set_alignment(0.5,0.5)
  relset.set_size_request(36,24)
  data = people.get(relid,None)
  genderR = ""
  if data: genderR = getInf(data,["info","gender"])
  if not genderR or genderR == "":
    p = loadPerson(relid)
    genderR = p[0].get("gender",['N',False])
    genderR = genderR[0]
  genderP = getInf(people.get(fileid),["info","gender"])
  relset.connect("clicked",selectConnectionP,relation,fileid,relid,name,cat,genderR,genderP)
  row1.pack_start(relset,0,0,5)
  row2 = gtk.HBox()
  self.pack_start(row2,0,0,2)
  row2.show()
  mileadd = gtk.Button("New Milestone")
  mileadd.show()
  mileadd.set_alignment(0.75,0.05)
#  mileadd.set_size_request(int(self.size_request()[0] * 0.30),24)
  row2.pack_start(mileadd,0,0,5)
  dhead = gtk.Label("Date")
  dhead.show()
  dhead.set_width_chars(8)
  row2.pack_start(dhead,1,1,2)
  ehead = gtk.Label("Event")
  ehead.show()
  ehead.set_width_chars(18)
  row2.pack_start(ehead,1,1,2)
  row2.show_all()
  row3 = gtk.VBox()
  row3.show()
  self.pack_start(row3,0,0,2)
  boxwidth = self.size_request()[0]
  mileadd.connect("clicked",addMilestone,scroll,row3,people.get(fileid),fileid,"relat",relid,boxwidth)
  if r.get("events"):
    for i in r['events']:
#      showMile(row3,r,i,fileid,relid)

#def showMile(row3,r,i,fileid,relid):
      events = r['events'][i]
#  print str(events)
      if events.get("date") and events.get("event"):
        rowmile = gtk.HBox()
        rowmile.show()
        blank = gtk.Label()
        blank.show()
        blank.set_width_chars(12)
        rowmile.pack_start(blank,0,0,2)
        d = gtk.Entry()
        d.show()
        d.set_width_chars(12)
        d.set_text(events['date'][0])
        data = people.get(fileid)
        activateRelEntry(d,psalts,scroll,data,fileid,relid,"date",i)
        rowmile.pack_start(d,1,1,2)
        placeCalendarButton(data,rowmile,d,[fileid,"relat",relid,"events",i,"date"],psalts,counter=ar)
        e = gtk.Entry()
        e.show()
        e.set_width_chars(18)
        e.set_text(events['event'][0])
        activateRelEntry(e,psalts,scroll,data,fileid,relid,"event",i)
        rowmile.pack_start(e,1,1,2)
        row3.add(rowmile)
示例#11
0
文件: person.py 项目: over2sd/minette
def initPinfo(self, fileid,ar,psalts):
  global people
  global config
  info = {}
  scroll = self.get_parent()
  try:
    info = people[fileid]['info']
  except KeyError as e:
    print "initPinfo: An error occurred accessing %s: %s" % (fileid,e)
    return
  scroll = self.get_parent()
  self.namelabelbox = gtk.HBox()
  self.namelabelbox.show()
  self.l1 = gtk.Label("Name:")
  self.l1.set_alignment(0,0)
  self.namelabelbox.pack_start(self.l1,1,1,2)
  self.nord = gtk.CheckButton("Order reversed")
  self.nord.show()
  self.nord.set_active(isOrderRev(fileid))
  self.nord.unset_flags(gtk.CAN_FOCUS)
  self.nord.connect("clicked",toggleOrder,fileid)
  self.namelabelbox.pack_start(self.nord,0,0,2)
  self.add(self.namelabelbox)
  self.namebox = gtk.HBox()
  self.namebox.set_border_width(2)
  self.add(self.namebox)
  self.namebox.show()
  self.l5 = gtk.Label("Title:")
  self.ctitle = gtk.Entry(5)
  self.l2 = gtk.Label("Family:")
  self.fname = gtk.Entry(25)
  activateInfoEntry(self.fname,ar,psalts,scroll,people.get(fileid),fileid,"fname")
  self.l3 = gtk.Label("Given:")
  self.gname = gtk.Entry(25)
  activateInfoEntry(self.gname,ar,psalts,scroll,people.get(fileid),fileid,"gname")
  self.l4 = gtk.Label("Middle/Maiden:")
  self.mname = gtk.Entry(25)
  activateInfoEntry(self.mname,ar,psalts,scroll,people.get(fileid),fileid,"mname")
  self.namebox.add(self.l5)
  self.namebox.add(self.ctitle)
  self.ctitle.set_width_chars(4)
  self.fname.set_width_chars(10)
  self.gname.set_width_chars(10)
  self.mname.set_width_chars(10)
  self.namebox.set_child_packing(self.ctitle,0,0,2,gtk.PACK_START)
  data = people.get(fileid)
  self.ctitle.set_text(getInf(data,["info","ctitle"]))
  self.ctitle.show()
  activateInfoEntry(self.ctitle,ar,psalts,scroll,people.get(fileid),fileid,"ctitle")
  if config['familyfirst'] == True:
    self.namebox.add(self.l2)
    self.namebox.add(self.fname)
  self.namebox.add(self.l3)
  self.namebox.add(self.gname)
  self.gname.set_text(getInf(data,["info","gname"]))
  self.gname.show()
  self.namebox.add(self.l4)
  self.namebox.add(self.mname)
  self.mname.set_text(getInf(data,["info","mname"]))
  if config['usemiddle'] == True:
    self.mname.show()
  if config['familyfirst'] == False:
    self.namebox.add(self.l2)
    self.namebox.add(self.fname)
  self.fname.set_text(getInf(data,["info","fname"]))
  self.fname.show()
  self.l1.show()
  self.l2.show()
  self.l3.show()
  self.l4.show()
  self.l5.show()
  self.cname = buildarow(scroll,"Common Name:",people.get(fileid),fileid,'commonname',ar,psalts,tooltip="Name commonly used to refer to this character\nShows at the top of the XSL template") # TODO: Some day, maybe move all these labels into a dict and generate these things algorithmically? What about sections?
  self.add(self.cname)
  self.nname = buildarow(scroll,"Nickname:",people.get(fileid),fileid,'nname',ar,psalts,tooltip="Something other characters call this one")
  self.add(self.nname)
  self.gender = buildGenderRow(scroll,people.get(fileid),fileid,ar,psalts)
  self.add(self.gender)
  self.bday = buildarow(scroll,"Birth Date:",people.get(fileid),fileid,'bday',ar,psalts,style=3,tooltip="Date of person's birth")
  self.add(self.bday)
  self.dday = buildarow(scroll,"Death Date:",people.get(fileid),fileid,'dday',ar,psalts,style=3,tooltip="Date of person's death")
  self.add(self.dday)
  self.l6 = gtk.Label("Stories")
  self.l6.set_alignment(0,0)
  self.l6.show()
  self.add(self.l6)
  self.s1 = gtk.HSeparator()
  self.add(self.s1)
  self.s1.show()
  self.stories = buildarow(scroll,"Stories:",people.get(fileid),fileid,'stories',ar,psalts,style=2,tooltip="Stories where this character appears")
  self.add(self.stories)
  storyDefault(self.stories.e,config['realmdir'])
  self.mention = buildarow(scroll,"First Mention:",people.get(fileid),fileid,'mention',ar,psalts,tooltip="In which (story:)scene does someone first mention this person?")
  self.add(self.mention)
  self.appearch = buildarow(scroll,"First appeared (chron):",people.get(fileid),fileid,'appear1ch',ar,psalts,tooltip="First scene where the person appeared, based on the scene's position in the story")
  self.add(self.appearch)
  self.appearwr = buildarow(scroll,"First appeared (writ):",people.get(fileid),fileid,'appear1wr',ar,psalts,tooltip="First scene where the person appeared, based on when the scene was written")
  self.add(self.appearwr)
  self.conflict = buildarow(scroll,"Conflict:",people.get(fileid),fileid,'conflict',ar,psalts,tooltip="What disputes does this person have with the protagonist, or on what issues do they disagree?")
  self.add(self.conflict)
  self.leadrel = buildarow(scroll,"Relation to lead:",people.get(fileid),fileid,'leadrel',ar,psalts,tooltip="What is this person's relationship to the protagonist/lead character?")
  self.add(self.leadrel)
  self.l7 = gtk.Label("Physical Appearance")
  self.l7.set_alignment(0,1)
  self.l7.show()
  self.add(self.l7)
  self.s2 = gtk.HSeparator()
  self.add(self.s2)
  self.s2.show()
  self.bodytyp = buildarow(scroll,"Body Type:",people.get(fileid),fileid,'bodytyp',ar,psalts,tooltip="Description of the person's body or general appearance")
  self.add(self.bodytyp)
  self.age = buildarow(scroll,"Age:",people.get(fileid),fileid,'age',ar,psalts,tooltip="How old is this person?")
  ageText(self.bday.e,self.dday.e,self.age)
  if config['hideage']: self.age.e.hide()
  self.add(self.age)
  self.skin = buildarow(scroll,"Skin:",people.get(fileid),fileid,'skin',ar,psalts,tooltip="Skin tone or type (e.g., light, dark, hairy, scaly)")
  self.add(self.skin)
  self.eyes = buildarow(scroll,"Eyes:",people.get(fileid),fileid,'eyes',ar,psalts,tooltip="Color, type, or attributes of the person's eyes")
  self.add(self.eyes)
  self.hair = buildarow(scroll,"Hair:",people.get(fileid),fileid,'hair',ar,psalts,tooltip="Color, amount, descriptions of the person's hair or fur")
  self.add(self.hair)
  self.dmarks = buildarow(scroll,"Distinguishing Marks:",people.get(fileid),fileid,'dmarks',ar,psalts,tooltip="Any markings that distinguish this person from others (birthmarks, scars, etc.)")
  self.add(self.dmarks)
  self.dress = buildarow(scroll,"Dress:",people.get(fileid),fileid,'dress',ar,psalts,tooltip="How does this person normally dress?")
  self.add(self.dress)
  self.attpos = buildarow(scroll,"Attached Possessions:",people.get(fileid),fileid,'attposs',ar,psalts,tooltip="What does this person usually have at hand?")
  self.add(self.attpos)
  self.asmell = buildarow(scroll,"Associated Smell:",people.get(fileid),fileid,'asmell',ar,psalts,tooltip="What smell(s) would others associate with this person?")
  self.add(self.asmell)
  self.l8 = gtk.Label("Personality Traits")
  self.l8.set_alignment(0,1)
  self.l8.show()
  self.add(self.l8)
  self.s3 = gtk.HSeparator()
  self.add(self.s3)
  self.s3.show()
  self.pers = buildarow(scroll,"Personality:",people.get(fileid),fileid,'personality',ar,psalts,tooltip="General description of personality")
  self.add(self.pers)
  self.speech = buildarow(scroll,"Distinct Speech:",people.get(fileid),fileid,'speech',ar,psalts,tooltip="Speech patterns that set this person apart")
  self.add(self.speech)
  self.formocc = buildarow(scroll,"Former Occupation:",people.get(fileid),fileid,'formocc',ar,psalts,style=1,tooltip="The person's previous job")
  self.add(self.formocc)
  self.curocc = buildarow(scroll,"Current Occupation:",people.get(fileid),fileid,'currocc',ar,psalts,style=1,tooltip="The person's current job or preoccupation")
  self.add(self.curocc)
  self.strength = buildarow(scroll,"Strengths:",people.get(fileid),fileid,'strength',ar,psalts,tooltip="What does this character do well or have as benefits?")
  self.add(self.strength)
  self.weak = buildarow(scroll,"Weakness:",people.get(fileid),fileid,'weak',ar,psalts,tooltip="What does this character do poorly, or what things keep this character from achieving goals easily?")
  self.add(self.weak)
  self.mole = buildarow(scroll,"Mole:",people.get(fileid),fileid,'mole',ar,psalts,)
  self.add(self.mole)
  self.hobby = buildarow(scroll,"Hobby:",people.get(fileid),fileid,'hobby',ar,psalts,tooltip="What does this character like to do with free time?")
  self.add(self.hobby)
  self.aspects = buildaspectrow(scroll,people.get(fileid),fileid,ar,psalts) # ,display = 0)
  self.add(self.aspects)
  self.l9 = gtk.Label("Miscellany")
  self.l9.set_alignment(0,1)
  self.l9.show()
  self.add(self.l9)
  self.s4 = gtk.HSeparator()
  self.add(self.s4)
  self.s4.show()
  self.misc = buildarow(scroll,"Misc:",people.get(fileid),fileid,'misc',ar,psalts,tooltip="Miscellaneous info") # make a textbox
  self.add(self.misc)
  self.ethnic = buildarow(scroll,"Ethnic background:",people.get(fileid),fileid,'ethnic',ar,psalts,tooltip="What kind of people are in this character's ancestry")
  self.add(self.ethnic)
  self.origin = buildarow(scroll,"Origin:",people.get(fileid),fileid,'origin',ar,psalts,tooltip="Where was this character born (or descended from)?")
  addLocButton(self.origin,0,entry=self.origin.e)
  self.add(self.origin)
  self.backs = buildarow(scroll,"Background:",people.get(fileid),fileid,'backstory',ar,psalts,tooltip="Major life events, experiences, training") # make a textbox someday?
  self.add(self.backs)
  self.residence = buildarow(scroll,"Place of residence:",people.get(fileid),fileid,'residence',ar,psalts,tooltip="Where the person lives")
  self.add(self.residence)
  self.minchar = buildarow(scroll,"Minor related characters:",people.get(fileid),fileid,'minchar',ar,psalts,tooltip="Related characters that are too minor to get a record")
  self.add(self.minchar)
  self.talent = buildarow(scroll,"Talents:",people.get(fileid),fileid,'talent',ar,psalts,tooltip="Inate gifts")
  self.add(self.talent)
  self.abil = buildarow(scroll,"Abilities:",people.get(fileid),fileid,'abil',ar,psalts,tooltip="Trained abilities") # textbox someday?
  self.add(self.abil)
  self.sgoal = buildarow(scroll,"Story goal:",people.get(fileid),fileid,'sgoal',ar,psalts,tooltip="What the person is trying to do in the current story")
  self.add(self.sgoal)
  self.other = buildarow(scroll,"Other notes:",people.get(fileid),fileid,'other',ar,psalts) # textbox someday
  self.add(self.other)
  el = gtk.Label("End of record")
  el.show()
  el.set_alignment(1,1)
  self.pack_start(el,0,0,3)
示例#12
0
文件: state.py 项目: over2sd/minette
def initSinfo(self, fileid,tabs,ar,stalts):
  global states
  data = {}
  scroll = self.get_parent()
  try:
    data = states.get(fileid)
  except KeyError as e:
    print "initSinfo: An error occurred accessing %s: %s" % (fileid,e)
    return
  label = gtk.Label("General")
  label.set_alignment(0,0)
  label.show()
  self.pack_start(label,0,0,1)
  self.s1 = gtk.HSeparator()
  self.pack_start(self.s1,False,False,2)
  self.s1.show()
  name = buildarow(scroll,"Name:",data,fileid,'name',ar,stalts)
  self.pack_start(name,0,0,2)
  row = gtk.HBox()
  row.show()
  path = ["info","start"]
  label = gtk.Label("Start Date:")
  label.show()
  row.pack_start(label,False,False,2)
  start = gtk.Entry(25)
  start.show()
  start.set_text(getInf(data,path))
  activateInfoEntry(start,ar,stalts,scroll,data,fileid,"start")
  row.pack_start(start,True,True,2)
  path2 = [fileid,"info"]
  path2.append(path[-1])
  placeCalendarButton(data,row,start,path2,stalts,counter=ar)
  label = gtk.Label("Cue:")
  label.show()
  row.pack_start(label,False,False,2)
  scue = gtk.Entry(25)
  scue.show()
  path[1] = "scue"
  scue.set_text(getInf(data,path))
  activateInfoEntry(scue,ar,stalts,scroll,data,fileid,"scue")
  row.pack_start(scue,True,True,2)
  self.pack_start(row,False,False,2)
  row = gtk.HBox()
  row.show()
  label = gtk.Label("End Date:")
  label.show()
  row.pack_start(label,False,False,2)
  end = gtk.Entry(25)
  end.show()
  path[1] = "end"
  end.set_text(getInf(data,path))
  activateInfoEntry(end,ar,stalts,scroll,data,fileid,"end")
  row.pack_start(end,True,True,2)
  path2 = [fileid,"info"]
  path2.append(path[-1])
  placeCalendarButton(data,row,end,path2,stalts,counter=ar)
  label = gtk.Label("Cue:")
  label.show()
  row.pack_start(label,False,False,2)
  ecue = gtk.Entry(25)
  ecue.show()
  path[1] = "ecue"
  ecue.set_text(getInf(data,path))
  activateInfoEntry(ecue,ar,stalts,scroll,data,fileid,"ecue")
  row.pack_start(ecue,True,True,2)
  self.pack_start(row,False,False,2)
  '''
	Vitals:
		State (i.e., empire, kingdom, republic, grand tribe)
		Adjective (Florida businesses)
		People (Floridians)
		Head of state (Governor)
		Capital (Tallahassee)
		Population
		Major resources
	Politics:
		Capital governance
		Foreign relations
		Organization (general)
	Culture
		Expected behaviors
		Rumors
	History
	Geography
	Economy
	Demographics
'''
  self.aspects = buildaspectrow(scroll,states.get(fileid),fileid,ar,stalts) # ,display = 0)
  self.add(self.aspects)
  self.notebox = gtk.VBox()
  self.notebox.show()
  self.pack_start(self.notebox,True,False,2)
  label = gtk.Label("Cities")
  label.set_alignment(0,0)
  label.show()
  self.notebox.pack_start(label,0,0,1)
  s1 = gtk.HSeparator()
  self.notebox.pack_start(s1,False,False,2)
  s1.show()
  box = gtk.HBox()
  box.show()
  addbut = gtk.Button("Register City")
  image = gtk.Image()
  image.set_from_file("img/add.png")
  image.show()
  addbut.set_image(image)
  addbut.show()
  path = ["info","cities"]
  statename = getInf(data,["info","name"],"")
  statecities = getInf(data,path,{})
  for c in statecities.keys():
    fi = c
    cityname = getInf(statecities,[fi,"name"],"")
    pushLoc(fileid,statename,fi,cityname)
  cbook = getCitiesIn(fileid)
  addbut.connect("clicked",chooseCity,self.notebox,tabs,scroll,data,fileid,ar,stalts,"Register in %s..." % statename)
  box.pack_end(addbut,False,False,1)
  self.notebox.pack_start(box,False,False,1)
  for c in sorted(cbook.keys()):
    if c != "_name":
      newcity = False
      cityname = cbook[c].get('_name',cbook.get(c,None))
      if c not in statecities.keys():
        newcity = True
        pushCity(fileid,c,cityname)
      if cityname is not None:
        packCity(self.notebox,scroll,data,fileid,c,cityname,tabs,newcity,ar,stalts)
      else:
        common.say("Error getting cityname.")
  el = gtk.Label("End of record")
  el.show()
  el.set_alignment(1,1)
  self.pack_start(el,0,0,3)