Exemple #1
0
def chooseCity(parent,target,tabs,scroll,data,statef,ar,stalts,title = ""):
  global status
  global cities
  city = recordSelectBox(None,statef,title,'c')
  if city and city[1] == "city":
    cityname = ""
    citlist = getCityList(0)
    cityf = validateFileid(citlist.get(statef,["",""])[1])
    cityname = citlist.get(statef,["",""])[0]
    statename = citlist.get(statef,["","",""])[2]
    try:
      cityname = cities[city[0]]['info']['name'][0]
      cities[city[0]]['info']['state'] = [statename,True]
      cities[city[0]]['info']['statefile'] = [statef,True]
      cities[city[0]]['info']['loc'] = [cityname,True]
      cities[city[0]]['info']['locfile'] = [cityf,True]
      cities[city[0]]['changed'] = True
      saveThisC(parent,city[0])
#      reloadPlaceTab(place[0]) # TODO: Write a function like this
    except KeyError:
#      placename = getPlaceNameFromID(place[0])
      cityname = askBox("?","  Please type the city name that goes with %s" % city[0],"Name",subtext="  I tried to load this from memory, but you\ndon't have %s open. Without it open, I can't\nsynchronize its city and state values.\n  This requirement prevents unintentional\nchanges to your place records." % city[0])
      # Maybe some day, I'll make this grab the placename from the file, and automatically load its record for updating
    if cityname == "":
      status.push(0,"Registering place in %s cancelled" % cityf)
      return False
    packCity(target,scroll,data,statef,city[0],cityname,tabs,True,ar,stalts)
    status.push(0,"Registered %s in %s" % (city[1],statef))
    return True
  else:
    status.push(0,"Registering place in %s cancelled" % statef)
    return False
Exemple #2
0
def connectToPlace(parent,target,tabs,scroll,fileid,ar,plalts,title = ""):
  global status
  relid = recordSelectBox(None,fileid,title,['l','p']) # TODO: organizations?
  if relid and len(relid[1]):
    addRelToBox(parent,target,relid,fileid,tabs,scroll,ar,plalts)
    status.push(0,"Added connection to %s on %s" % (relid[0],fileid))
  else:
    status.push(0,"Adding connection on %s cancelled" % fileid)
Exemple #3
0
def connectToPerson(parent,target,tabs,scroll,fileid,title = ""):
  global status
  relid = recordSelectBox(None,fileid,title)
  if relid and len(relid[1]):
    addRelToBox(parent,target,relid,fileid,tabs,scroll)
    status.push(0,"Added connection to %s on %s" % (relid,fileid))
  else:
    status.push(0,"Adding connection on %s cancelled" % fileid)
Exemple #4
0
def choosePlace(parent, target, tabs, scroll, data, cityf, ar, ctalts, title=""):
    global status
    global places
    place = recordSelectBox(None, cityf, title, "l")
    if place and place[1] == "place":
        placename = ""
        citlist = getCityList(0)
        statef = validateFileid(citlist.get(cityf, ["", ""])[1])
        cityname = citlist.get(cityf, ["", ""])[0]
        statename = citlist.get(cityf, ["", "", ""])[2]
        try:
            placename = places[place[0]]["info"]["name"][0]
            places[place[0]]["info"]["state"] = [statename, True]
            places[place[0]]["info"]["statefile"] = [statef, True]
            places[place[0]]["info"]["loc"] = [cityname, True]
            places[place[0]]["info"]["locfile"] = [cityf, True]
            places[place[0]]["changed"] = True
            saveThisL(parent, place[0])
        #      reloadPlaceTab(place[0]) # TODO: Write a function like this
        except KeyError:
            #      placename = getPlaceNameFromID(place[0])
            placename = askBox(
                None,
                "  Please type the location name that goes with %s" % place[0],
                "Name",
                subtext="  I tried to load this from memory, but you\ndon't have %s open. Without it open, I can't\nsynchronize its city and state values.\n  This requirement prevents unintentional\nchanges to your place records."
                % place[0],
            )
            # Maybe some day, I'll make this grab the placename from the file, and automatically load its record for updating
        if placename == "":
            status.push(0, "Registering place in %s cancelled" % cityf)
            return False
        packPlace(target, scroll, data, cityf, place[0], placename, tabs, True, ar, ctalts)
        status.push(0, "Registered %s in %s" % (place[1], cityf))
        return True
    else:
        status.push(0, "Registering place in %s cancelled" % cityf)
        return False