def ok(self, entry_profile, entry_description): # # Now everything is correct, create the profile # profile_data = (self.profile_id, entry_profile, entry_description) if (self.new_profile): # Check the login do not exist already self.cur.execute('SELECT name FROM profiles WHERE name=?', (unicode(entry_profile), )) if (self.cur.fetchone()): dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("There is already a profile with this name")) dialog.run() dialog.destroy() return # Create the new profile profile_id = constants.get_next_profile_id(self.con, self.cur) self.cur.execute( 'INSERT INTO profiles (profile_id, name, description) ' + 'VALUES ( ?, ?, ?)', (profile_data)) else: # Save the profile changes self.cur.execute( 'UPDATE profiles SET name=?, description=? where profile_id=?', (entry_profile, entry_description, self.profile_id)) self.con.commit()
def on_add_profile_clicked(self, button, model): profile_id = constants.get_next_profile_id(self.con, self.cur) profile_edit.ProfileEdit(self.con, self.cur, profile_id, None, None, self)
def ok(self, button): # Tell the user he must provide enough information if(self.entry_profile.get_text().strip() == ""): dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("You need to provide at least a name for your profile")) dialog.run() dialog.destroy() return # # Now everything is correct, create the profile # profile_data = (self.profile_id, self.entry_profile.get_text().strip(), self.entry_description.get_text() ) if(self.new_profile): # Check the login do not exist already self.cur.execute('SELECT name FROM profiles WHERE name=?', (self.entry_profile.get_text(),)) if(self.cur.fetchone()): dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("There is already a profile with this name")) dialog.run() dialog.destroy() return # Create the new profile profile_id = constants.get_next_profile_id(self.con, self.cur) self.cur.execute('INSERT INTO profiles (profile_id, name, description) ' + 'VALUES ( ?, ?, ?)', (profile_data)); else: # Save the profile changes self.cur.execute('UPDATE profiles SET name=?, description=? where profile_id=?', (self.entry_profile.get_text(), self.entry_description.get_text(), self.profile_id)); self.con.commit() # Close the dialog window now self.profile_list.reload_profile() self.destroy()
def ok(self, button): # Tell the user he must provide enough information if (self.entry_profile.get_text().strip() == ""): dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("You need to provide at least a name for your profile")) dialog.run() dialog.destroy() return # # Now everything is correct, create the profile # profile_data = (self.profile_id, self.entry_profile.get_text().strip(), self.entry_description.get_text()) if (self.new_profile): # Check the login do not exist already self.cur.execute('SELECT name FROM profiles WHERE name=?', (self.entry_profile.get_text(), )) if (self.cur.fetchone()): dialog = gtk.MessageDialog( None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("There is already a profile with this name")) dialog.run() dialog.destroy() return # Create the new profile profile_id = constants.get_next_profile_id(self.con, self.cur) self.cur.execute( 'INSERT INTO profiles (profile_id, name, description) ' + 'VALUES ( ?, ?, ?)', (profile_data)) else: # Save the profile changes self.cur.execute( 'UPDATE profiles SET name=?, description=? where profile_id=?', (self.entry_profile.get_text(), self.entry_description.get_text(), self.profile_id)) self.con.commit() # Close the dialog window now self.profile_list.reload_profile() self.destroy()
def ok(self, entry_profile, entry_description): # # Now everything is correct, create the profile # profile_data = (self.profile_id, entry_profile, entry_description ) if(self.new_profile): # Check the login do not exist already self.cur.execute('SELECT name FROM profiles WHERE name=?', (unicode(entry_profile),)) if(self.cur.fetchone()): dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("There is already a profile with this name")) dialog.run() dialog.destroy() return # Create the new profile profile_id = constants.get_next_profile_id(self.con, self.cur) self.cur.execute('INSERT INTO profiles (profile_id, name, description) ' + 'VALUES ( ?, ?, ?)', (profile_data)); else: # Save the profile changes self.cur.execute('UPDATE profiles SET name=?, description=? where profile_id=?', (entry_profile, entry_description, self.profile_id)); self.con.commit()