예제 #1
0
파일: state.py 프로젝트: over2sd/minette
def saveThisS(caller,fileid):
  global status
  if states.get(fileid):
    pushLoc(fileid,states[fileid].get('name'))
    if saveState(fileid,states[fileid]):
      status.push(0,"%s saved successfully." % fileid)
    else:
      status.push(0,"Error encountered saving %s." % fileid)
  else:
    bsay(caller,"saveThisS: Could not find state %s." % fileid)
예제 #2
0
파일: state.py 프로젝트: over2sd/minette
def mkState(callingWidget,fileid,tabs):
  global states
  if idExists(fileid,'s'):
    say("Existing fileid! Loading instead...")
  else:
    states[fileid] = {}
    states[fileid]['info'] = loadState(fileid)
    states[fileid]['changed'] = False
    states[fileid]['cat'] = 's'
    pushLoc(fileid)
    saveThisS(callingWidget,fileid)
  displayState(callingWidget,fileid,tabs)
예제 #3
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)
예제 #4
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)