예제 #1
0
 def Ok(self,widget):
   '''When the Add Cast Dialog's OK button is hit'''
   Casts = KirbyBase()
   treeCastList = self.pyCast.get_widget("podcastlist")
   treeSelection = treeCastList.get_selection()
   (model, iter) = treeSelection.get_selected()
   selected = model.get_value(iter,0)
   print selected
   Casts.delete(CASTDB,['name'],['^'+selected+'$'])
   UpdateCastDisplay(self.pyCast)
   self.wRemoveCast.destroy()
예제 #2
0
print db.insert('plane.tbl', {'name': 'FW-190', 'country': 'Germany',
 'role': 'Fighter', 'speed': 399, 'range': 499,
 'began_service': datetime.date(1942,12,1), 'still_flying': False})
print db.insert('plane.tbl', {'name': 'Zero', 'country': 'Japan',
 'role': 'Fighter', 'speed': 377, 'range': 912,
 'began_service': datetime.date(1937,5,15), 'still_flying': True})

# Change all records that have 'Great Britain' in country field to 'England'.
db.update('plane.tbl', ['country'],['Great Britain'],['England'],['country'])

# Now do an update using a dictionary instead of a list.
db.update('plane.tbl', ['recno'],[7],{'speed': 367})

# Delete the FW-190.  Use equality matching (i.e. '=='), instead of regular
# expression matching.
db.delete('plane.tbl', ['name'],['FW-190'], False)

# Remove deleted (i.e. blank) lines from the table.
db.pack('plane.tbl')

# Select all Japanese planes.
print db.select('plane.tbl', ['country'],['Japan'])

# Select all US planes with a speed greater than 400mph.  When specifiying
# selection criteria against numeric fields, you use python comparison
# expressions (i.e. >,<,==,>=,<=).
print db.select('plane.tbl', ['country','speed'],['USA','>400'])

# Select all bombers, but not fighter-bombers.  When specifying selection
# criteria against string fields, you use python regular expression syntax.
print db.select('plane.tbl', ['role'],['^Bomber'])