コード例 #1
0
ファイル: ui_user.py プロジェクト: tejastank/simplestock
 def group_new(self, widget):
     group = gtkutils.input(title='New Group',
                            label='Group name',
                            parent=self.group_edit_dialog).strip().upper()
     if group:
         groups = self.get_groups()
         found = self.get_group_id(group)
         #
         if found:
             msg = 'Group %s already exists' % (group)
             gtkutils.error(title='Error', message=msg, parent=self.parent)
         else:
             q = '''
             insert into ms_groups(group_name, resources)
             values(?,?)
             '''
             a = (group, '')
             r = self.db.query(q, a, self.app.database)
             if r[0] != 0:
                 msg = r[1]
                 dialog = gtkutils.error
                 dialog(title='Error',
                        message=msg,
                        parent=self.group_edit_dialog)
             else:
                 self.group_populate_groups(active=group,
                                            combo=self.combo_grp)
コード例 #2
0
ファイル: ui_user.py プロジェクト: impossibler/simplestock
 def group_rename(self, widget):
     group = self.combo_grp.get_active_text()
     if group:
         newgroup = gtkutils.input(title='Rename Group', label='New group name',
         parent=self.group_edit_dialog, default=group).strip().upper()
         if newgroup:
             groups = self.get_groups()
             found=False
             for g in groups:
                 if newgroup == g[1] and newgroup!=group:
                     found=True
                     break
             #
             if found:
                 msg = 'Group %s already exists' %(newgroup)
                 gtkutils.error(title='Error', message=msg, 
                     parent=self.parent)
             else:
                 q = '''
                 update ms_groups set group_name=? where group_name=?
                 '''
                 a = (newgroup, group)
                 r = self.db.query(q, a, self.app.database)
                 if r[0] != 0:
                     msg = r[1]
                     dialog = gtkutils.error
                     dialog(title='Error', message=msg, parent=self.group_edit_dialog)
                 else:
                     self.group_populate_groups(combo=self.combo_grp, active=newgroup)
コード例 #3
0
ファイル: ui_user.py プロジェクト: tejastank/simplestock
 def group_rename(self, widget):
     group = self.combo_grp.get_active_text()
     if group:
         newgroup = gtkutils.input(title='Rename Group',
                                   label='New group name',
                                   parent=self.group_edit_dialog,
                                   default=group).strip().upper()
         if newgroup:
             groups = self.get_groups()
             found = False
             for g in groups:
                 if newgroup == g[1] and newgroup != group:
                     found = True
                     break
             #
             if found:
                 msg = 'Group %s already exists' % (newgroup)
                 gtkutils.error(title='Error',
                                message=msg,
                                parent=self.parent)
             else:
                 q = '''
                 update ms_groups set group_name=? where group_name=?
                 '''
                 a = (newgroup, group)
                 r = self.db.query(q, a, self.app.database)
                 if r[0] != 0:
                     msg = r[1]
                     dialog = gtkutils.error
                     dialog(title='Error',
                            message=msg,
                            parent=self.group_edit_dialog)
                 else:
                     self.group_populate_groups(combo=self.combo_grp,
                                                active=newgroup)
コード例 #4
0
ファイル: ui_user.py プロジェクト: impossibler/simplestock
 def group_new(self, widget):
     group = gtkutils.input(title='New Group', label='Group name',
         parent=self.group_edit_dialog).strip().upper()
     if group:
         groups = self.get_groups()
         found=self.get_group_id(group)
         #
         if found:
             msg = 'Group %s already exists' %(group)
             gtkutils.error(title='Error', message=msg, 
                 parent=self.parent)
         else:
             q = '''
             insert into ms_groups(group_name, resources)
             values(?,?)
             '''
             a = (group, '')
             r = self.db.query(q, a, self.app.database)
             if r[0] != 0:
                 msg = r[1]
                 dialog = gtkutils.error
                 dialog(title='Error', message=msg, parent=self.group_edit_dialog)
             else:
                 self.group_populate_groups(active=group, combo=self.combo_grp)