示例#1
0
class BundleWidget(QtGui.QWidget, Ui_BundleWidget):
    def __init__(self, bundle, *args, **kwargs):
        super(BundleWidget, self).__init__(*args, **kwargs)
        self.scroll_on = True
        self.bundle = bundle
        self.setupUi()
        self.bindUi()

    def set_vertical_scroll(self, on):
        self.scroll_on = on
        self.updateGeometry()

    def sizeHint(self):
        s = None
        if self.scroll_on:
            s = super(BundleWidget, self).sizeHint()
        else:
            s = QtCore.QSize(
                super(BundleWidget, self).sizeHint().width(),
                50 + self.contents.sizeHint().height())
        return s

    def setupUi(self):
        super(BundleWidget, self).setupUi(self)
        self.delete_confirmation = ConfirmDialog(
            "Are You sure you want to delete this operation?")
        self.delete_confirmation.accepted.connect(self.on_delete_accepted)
        self.delete_confirmation.rejected.connect(self.on_delete_rejected)

    def bindUi(self):
        self.contents.set_bundle(self.bundle)

    def on_delete_accepted(self):
        self.contents.remove_operation(self.op_to_delete)

    def on_delete_rejected(self):
        self.op_to_delete = None

    def delete_clicked(self):
        self.op_to_delete = self.sender()
        self.delete_confirmation.show()

    def get_dict(self):
        return self.contents.get_dict()
示例#2
0
class BundleWidget(QtGui.QWidget, Ui_BundleWidget):
  def __init__(self, bundle, *args, **kwargs):
    super(BundleWidget, self).__init__(*args, **kwargs)
    self.scroll_on = True
    self.bundle= bundle
    self.setupUi()
    self.bindUi()

  def set_vertical_scroll(self, on):
    self.scroll_on = on
    self.updateGeometry()

  def sizeHint(self):
    s = None
    if self.scroll_on:
      s = super(BundleWidget,self).sizeHint()
    else:
      s = QtCore.QSize(super(BundleWidget,self).sizeHint().width(), 50+ self.contents.sizeHint().height())
    return s

  def setupUi(self):
    super(BundleWidget, self).setupUi(self)
    self.delete_confirmation = ConfirmDialog("Are You sure you want to delete this operation?")
    self.delete_confirmation.accepted.connect(self.on_delete_accepted)
    self.delete_confirmation.rejected.connect(self.on_delete_rejected)

  def bindUi(self):
    self.contents.set_bundle(self.bundle)

  def on_delete_accepted(self):
    self.contents.remove_operation(self.op_to_delete)
      
  def on_delete_rejected(self):
    self.op_to_delete = None
    
  def delete_clicked(self):
    self.op_to_delete = self.sender()
    self.delete_confirmation.show()

  def get_dict(self):
    return self.contents.get_dict()
示例#3
0
class VariablesWindow(QtGui.QWidget, Ui_VariablesWindow):
  def __init__(self, *args, **kwargs):
    super(VariablesWindow, self).__init__(*args, **kwargs)
    self.parent = kwargs.has_key('parent') and kwargs['parent'] or None
    self.setupUi(self)
    self.lv_items.installEventFilter(self)
    self.details_parent = None

  def setMode(self, mode):
    if not mode in ['admin', 'moderator']:
      self.btn_add.hide()
      self.btn_delete.hide()

  def setModel(self, data_model):
    self.data_model = data_model
    self.lv_items.setModel(data_model)
    self.lv_items.doubleClicked.connect(self.__on_variable_edit)
    self.btn_add.clicked.connect(self.__on_add_clicked)
    self.btn_delete.clicked.connect(self.__on_remove_clicked)

  def setDetailsContainer(self, container):
    self.details_parent = container
  def eventFilter(self, sender, event):
    if event.type() == QtCore.QEvent.KeyPress and event.matches(QtGui.QKeySequence.InsertParagraphSeparator) and sender == self.lv_items:
      self.__on_variable_edit()
    elif event.type() == QtCore.QEvent.KeyPress and event.matches(QtGui.QKeySequence.Delete) and sender == self.lv_items:
      self.__on_remove_clicked()
    elif event.type() == QtCore.QEvent.KeyPress and event.matches(QtGui.QKeySequence.New) and sender == self.lv_items:
      self.__on_add_clicked()
    else:
      return super(VariablesWindow, self).eventFilter(sender, event)

  def __on_add_clicked(self):
    self.edit_index = None
    parent = self.details_parent or QtGui.QDialog()
    self.new_dlg = VariableDialog(parent)
    new_var =HalVar('', '')
    new_var.type = 'text'
    self.new_dlg.setModel(new_var)
    self.new_dlg.show()
    self.new_dlg.accepted.connect(self.__on_add_accepted)
    self.new_dlg.rejected.connect(self.__on_add_rejected)

  def __on_variable_edit(self):
    self.edit_index = self.lv_items.currentIndex()
    obj = self.data_model.data(self.edit_index, QtCore.Qt.EditRole)
    parent = self.details_parent or QtGui.QDialog()
    self.new_dlg = VariableDialog(parent)
    if not isinstance(parent,  QtGui.QDialog):
      parent.children()[0].addWidget(self.new_dlg)

    self.new_dlg.setModel(obj)
    self.new_dlg.show()
    self.new_dlg.accepted.connect(self.__on_add_accepted)
    self.new_dlg.rejected.connect(self.__on_add_rejected)

  def __on_add_accepted(self):
    variable = self.new_dlg.model
    if self.edit_index==None:
      self.data_model.appendData(variable)
    else:
      self.data_model.setData(self.edit_index, variable)

  def __on_add_rejected(self):
    "print rejected"

  def __on_remove_clicked(self):
    self.dialog = ConfirmDialog("Are you sure you want to delete this item")
    self.dialog.accepted.connect(self.__on_remove_confirmed)
    self.dialog.rejected.connect(self.__on_remove_rejected)
    self.dialog.show()


  def __on_remove_confirmed(self):
    print "remove clicked"
    print "will remove selected resource when implemented"
    print "selected resource is "+str(self.lv_items.currentIndex().row())
    self.data_model.removeData(self.lv_items.currentIndex().row())

  def __on_remove_rejected(self):
    print "remove cancelled"
class BundleWidget(QtGui.QWidget, Ui_BundleWidget):
  def __init__(self, bundle, *args, **kwargs):
    super(BundleWidget, self).__init__(*args, **kwargs)
    self.bundle= bundle
    self.ops = []
    self.setupUi()
    self.bindUi()

  def setupUi(self):
    super(BundleWidget, self).setupUi(self)
    self.delete_confirmation = ConfirmDialog("Are You sure you want to delete this operation?")
    self.delete_confirmation.accepted.connect(self.on_delete_accepted)
    self.delete_confirmation.rejected.connect(self.on_delete_rejected)
    self.btn_add_operation.clicked.connect(self.add_clicked)
    
  def bindUi(self):
    for op in self.bundle["Operations"]:
      self.add_operation(op)
  
  def add_clicked(self):
    b = self.op_chooser = OpChooserDialog()
    b.show()
    def on_code_chosen():
      model = b.cmb.model()
      op = model.data(model.createIndex(b.cmb.currentIndex(), 0), role = QtCore.Qt.UserRole)
      print op
      b.deleteLater()
      self.add_operation(op.get_empty_dict())
    b.cmb.currentIndexChanged.connect(on_code_chosen)
    b.show()
  
  def on_delete_accepted(self):
    l = [x for x in self.ops if x == self.op_to_delete ]
    if len(l)>0:
      print "removing"
      self.ops.remove(self.op_to_delete)
    self.op_to_delete.deleteLater()

  def remove_operation(self, op):
    self.ops.remove(op)
    op.deleteLater()


  def on_delete_rejected(self):
    self.op_to_delete = None
    
  def delete_clicked(self):
    self.op_to_delete = self.sender().parent().parent()
    self.delete_confirmation.show()

  def add_operation(self, op):
    op = OperationWidget(self, op, self)
    #op.btn_delete.clicked.connect(self.delete_clicked)
    self.ops.append(op)
    self.ltv_operations.addWidget(op)
  
  def get_dict(self):
    res = {}
    res["Name"] = self.bundle["Name"]
    ops = res["Operations"] = []
    for op in self.ops:
      ops.append(op.get_dict())
    return res
    
示例#5
0
class VariablesWindow(QtGui.QWidget, Ui_VariablesWindow):
    def __init__(self, *args, **kwargs):
        super(VariablesWindow, self).__init__(*args, **kwargs)
        self.parent = kwargs.has_key('parent') and kwargs['parent'] or None
        self.setupUi(self)
        self.lv_items.installEventFilter(self)
        self.details_parent = None

    def setMode(self, mode):
        if not mode in ['admin', 'moderator']:
            self.btn_add.hide()
            self.btn_delete.hide()

    def setModel(self, data_model):
        self.data_model = data_model
        self.lv_items.setModel(data_model)
        self.lv_items.doubleClicked.connect(self.__on_variable_edit)
        self.btn_add.clicked.connect(self.__on_add_clicked)
        self.btn_delete.clicked.connect(self.__on_remove_clicked)

    def setDetailsContainer(self, container):
        self.details_parent = container

    def eventFilter(self, sender, event):
        if event.type() == QtCore.QEvent.KeyPress and event.matches(
                QtGui.QKeySequence.InsertParagraphSeparator
        ) and sender == self.lv_items:
            self.__on_variable_edit()
        elif event.type() == QtCore.QEvent.KeyPress and event.matches(
                QtGui.QKeySequence.Delete) and sender == self.lv_items:
            self.__on_remove_clicked()
        elif event.type() == QtCore.QEvent.KeyPress and event.matches(
                QtGui.QKeySequence.New) and sender == self.lv_items:
            self.__on_add_clicked()
        else:
            return super(VariablesWindow, self).eventFilter(sender, event)

    def __on_add_clicked(self):
        self.edit_index = None
        parent = self.details_parent or QtGui.QDialog()
        self.new_dlg = VariableDialog(parent)
        new_var = HalVar('', '')
        new_var.type = 'text'
        self.new_dlg.setModel(new_var)
        self.new_dlg.show()
        self.new_dlg.accepted.connect(self.__on_add_accepted)
        self.new_dlg.rejected.connect(self.__on_add_rejected)

    def __on_variable_edit(self):
        self.edit_index = self.lv_items.currentIndex()
        obj = self.data_model.data(self.edit_index, QtCore.Qt.EditRole)
        parent = self.details_parent or QtGui.QDialog()
        self.new_dlg = VariableDialog(parent)
        if not isinstance(parent, QtGui.QDialog):
            parent.children()[0].addWidget(self.new_dlg)

        self.new_dlg.setModel(obj)
        self.new_dlg.show()
        self.new_dlg.accepted.connect(self.__on_add_accepted)
        self.new_dlg.rejected.connect(self.__on_add_rejected)

    def __on_add_accepted(self):
        variable = self.new_dlg.model
        if self.edit_index == None:
            self.data_model.appendData(variable)
        else:
            self.data_model.setData(self.edit_index, variable)

    def __on_add_rejected(self):
        "print rejected"

    def __on_remove_clicked(self):
        self.dialog = ConfirmDialog(
            "Are you sure you want to delete this item")
        self.dialog.accepted.connect(self.__on_remove_confirmed)
        self.dialog.rejected.connect(self.__on_remove_rejected)
        self.dialog.show()

    def __on_remove_confirmed(self):
        print "remove clicked"
        print "will remove selected resource when implemented"
        print "selected resource is " + str(self.lv_items.currentIndex().row())
        self.data_model.removeData(self.lv_items.currentIndex().row())

    def __on_remove_rejected(self):
        print "remove cancelled"
示例#6
0
class Process(QObject):

    def __init__(self, ldir, rdir, welcomeVid, waitVid, mdir, withCam):
        QObject.__init__(self)
        self.logger = logging.getLogger(__name__)
        self.ldir = ldir
        self.rdir = rdir
        self.withCam = withCam
        self.waitVid = mdir + waitVid
        if withCam:
            self.cam = Camera(ldir, mdir)
        self.w_w = WelcomeWindow(mdir + welcomeVid)
        self.running = False
        self.waiting = True
        self.minutes = 0
        self.t_w = None
        self.d_w = None
        self.v_w = None
        self.c_d = None
        self.num = 0
        self.img = "20200501_132612"
        self.sftp = Sftp(mdir, withCam)

    def reinit(self):
        self.t_w = None
        self.c_d = None
        self.d_w = None
        self.num = 0

    def start(self):
        self.noteActivity("Processus central démarré")
        self.w_w.takeButton.clicked.connect(self.takePicture)
        self.w_w.showFullScreen()
        self.w_w.player.play()
        self.noteActivity("Ecran de bienvenue affiché")
        QTimer.singleShot(1000, self.check)

    def takePicture(self):
        self.w_w.player.pause()
        self.noteActivity("Bouton 'Prendre une photo' appuyé")
        self.picture()

    def picture(self):
        if self.withCam:
            self.img = self.cam.takePicture()
        self.noteActivity("Photo prise")
        self.num = self.num + 1
        self.d_w = DisplayWindow(self.num, self.img, self.ldir)
        self.d_w.redoButton.clicked.connect(self.redoPicture)
        self.d_w.okButton.clicked.connect(self.okPicture)
        self.d_w.cancelButton.clicked.connect(self.cancelPicture)
        self.d_w.showFullScreen()
        self.noteActivity("Ecran d'affichage affiché")

    def redoPicture(self):
        self.noteActivity("Nouvelle photo demandée")
        self.d_w.close()
        self.d_w = None
        self.picture()

    def cancelPicture(self):
        self.noteActivity("Processus de photo annulé")
        self.d_w.close()
        self.reinit()
        self.w_w.player.play()

    def okPicture(self):
        self.noteActivity("Photo acceptée")
        self.num = 0
        self.d_w.close()
        self.d_w = None
        self.t_w = ThanksWindow()
        self.t_w.okButton.clicked.connect(self.okThanks)
        self.t_w.cancelButton.clicked.connect(self.cancelThanks)
        self.t_w.emailYesButton.clicked.connect(self.yesEmail)
        self.t_w.emailNoButton.clicked.connect(self.noEmail)
        self.t_w.socialYesButton.clicked.connect(self.yesSocial)
        self.t_w.socialNoButton.clicked.connect(self.noSocial)
        self.t_w.showFullScreen()
        self.noteActivity("Ecran d'envoi affiché")

    def okThanks(self):
        self.noteActivity("Bouton ok envoi appuyé")
        if self.t_w.sendEmail() and not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)",
                                                 self.t_w.getEmail()):
            self.noteActivity("Mauvais format d'adresse e-mail : ok non-soumis, message d'erreur affiché")
            self.t_w.setErrorMessage("Mauvais format d'adresse e-mail")
        else:
            data = {'date': time.strftime("%d-%m-%y"), 'heure': time.strftime("%H:%M"),
                    'image' : self.img + '.jpg'}
            if self.t_w.sendSocial():
                data['social media'] = "yes"
            else:
                data['social media'] = "no"
            if self.t_w.sendEmail():
                data['email'] = self.t_w.getEmail()
            else:
                data['email'] = "no"
            with open(self.ldir + self.img + '.json', mode='w') as outfile:
                json.dump(data, outfile, indent=4)
            self.noteActivity("JSON sauvegardé")
            self.c_d = ConfirmDialog()
            self.c_d.okButton.clicked.connect(self.okConfirm)
            self.c_d.show()
            
    def okConfirm(self):                
            self.t_w.close()           
            self.c_d.close()
            self.reinit()
            self.w_w.player.play()
            self.noteActivity("Processus réinitialisé")

    def cancelThanks(self):
        self.noteActivity("Processus de photo annulé")
        self.t_w.close()
        self.reinit()
        self.w_w.player.play()

    def yesEmail(self):
        self.noteActivity("Demande d'envoi par e-mail")
        self.t_w.adressLabel.setVisible(True)
        self.t_w.adressEdit.setVisible(True)

    def noEmail(self):
        self.noteActivity("Refus d'envoi par e-mail")
        self.t_w.adressLabel.setVisible(False)
        self.t_w.adressEdit.setVisible(False)

    def yesSocial(self):
        self.noteActivity("Demande de mise sur les réseaux sociaux")
        self.sendSocial = True

    def noSocial(self):
        self.noteActivity("Refus de mise sur les réseaux sociaux")
        self.sendSocial = False

    def noteActivity(self, message):
        self.logger.info(message)
        self.running = True

    def check(self):
        print(self.minutes)
        
        if not self.running:
            if self.minutes < 5:
                self.minutes += 1
                QTimer.singleShot(2000, self.check)
            else:
                self.noteActivity("Mise en veille")
                self.minutes = 0
                self.v_w = WaitWidget(self.waitVid)
                self.v_w.pressedSignal.connect(self.pressed)
                self.v_w.showFullScreen()
                self.w_w.player.stop()
                self.reinit()
                QTimer.singleShot(1000, self.download)
                self.v_w.player.play()
                self.waiting = True
        else:
            self.minutes = 0
            self.running = False
            QTimer.singleShot(2000, self.check)
            

    def pressed(self):
        self.noteActivity("Réveil")
        self.v_w.player.stop()
        self.waiting = False
        self.v_w.close()
        self.w_w.player.play()
        QTimer.singleShot(1000, self.check)

    def download(self):
        if self.sftp.connect():
            for f in os.listdir(self.ldir):
                if os.path.isfile(os.path.join(self.ldir, f)):
                    if f.endswith(".jpg"):
                        name = f.split(".")[0]
                        if os.path.exists(os.path.join(self.ldir, name + ".json")):
                            self.noteActivity("Envoi de " + name)
                            if self.sftp.put(f, self.ldir, self.rdir):
                                if self.sftp.put(name + ".json", self.ldir, self.rdir):
                                    os.remove(os.path.join(self.ldir, f))
                                    os.remove(os.path.join(self.ldir, name + ".json"))
                        else:
                            self.noteActivity("Suppression de l'image sans json : " + name)
                            os.remove(os.path.join(self.ldir, f))
                if not self.waiting:
                    self.sftp.close()
                    break
示例#7
0
class ResourceDialog(QtGui.QWidget, Ui_ResourceDialog):
  accepted = QtCore.Signal()
  rejected = QtCore.Signal()
  def __init__(self, root_dir, *args, **kwargs):
    super(ResourceDialog, self).__init__(*args, **kwargs)
    self.edited_resource = None
    self.model = None
    self.setupUi()
    self.bindUi()
    self.root_dir = root_dir
    self.model = {
                  "rid":None,
                  "url":None
                  }
  def show(self):
    if self.parent():
      self.parent().children()[0].addWidget(self)
    super(ResourceDialog, self).show()

  def setupUi(self):
    super(ResourceDialog, self).setupUi(self)

  def setModel(self, model):
    self.model = model
    self.txtName.setText(self.model["rid"])
    self.display_resource()

  def display_resource(self):
    self.scene = QtGui.QGraphicsScene()
    self.gvView.setScene(self.scene)
    resource_path = None
    if self.edited_resource:
      resource_path = self.edited_resource["url"]
    else:
      if self.model["url"]:
        resource_path = os.path.join(self.root_dir, self.model["url"])
    if resource_path:
      item  = QtGui.QGraphicsPixmapItem(QtGui.QPixmap(resource_path))
      self.scene.addItem(item)

  def export_resource(self):
    flt = None
    ext = ''
    resource_path = os.path.join(self.root_dir, self.model["url"])
    if self.model.has_key('extension') and self.model['extension']:
      flt = self.model['extension']
      ext = self.model['extension']
    fd, s = QtGui.QFileDialog.getSaveFileName(self, "Where to export the resource", self.model['rid']+ext, flt)  # @UnusedVariable
    if fd:
      shutil.copy(resource_path, fd)
      msgBox = QtGui.QMessageBox()
      msgBox.setText("Resource succesfully exported")
      msgBox.setInformativeText("Resource %s is successfuly exported"%self.model['rid'])
      msgBox.exec_()


  def bindUi(self):
    self.txtName.textEdited.connect(self.ridEdited)
    self.btnChange.clicked.connect(self.change_clicked)
    self.btnSave.clicked.connect(self.save_clicked)
    self.btnCancel.clicked.connect(self.cancel_clicked)
    self.btnExport.clicked.connect(self.export_resource)

  def save_clicked(self):
    print 'save clicked'
    if self.edited_resource:
      self.cd = ConfirmDialog("Are you sure you want to save this Resource")
      self.cd.accepted.connect(self.on_confirmed)
      self.cd.rejected.connect(self.on_rejected)
      self.cd.show()
    else:
      self.done(0)

  def on_confirmed(self):
    if self.edited_resource and self.edited_resource["url"] and self.edited_resource["url"][0]!='.':
      dest=None
      if self.model["url"]:
        dest = self.model["url"]
      else:
        dest = './Resources/'+''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(15)) #@UnusedVariable
      if not os.path.exists(os.path.dirname(os.path.join(self.root_dir, dest))):
        os.makedirs(os.path.dirname(os.path.join(self.root_dir, dest)))
      shutil.copy(self.edited_resource["url"], os.path.join(self.root_dir, dest))
      self.edited_resource["url"]=dest
    self.done(1)


  def on_rejected(self):
    pass

  def cancel_clicked(self):
    print 'edit canceled'
    self.done(0)
  def done(self, value):
    if value:
      self.accepted.emit()
    else:
      self.rejected.emit()
    self.close()

  def change_clicked(self):
    self.fo_di = QtGui.QFileDialog()
    self.fo_di.fileSelected.connect(self.file_selected)
    self.fo_di.show()

  def ridEdited(self, text):
    if not self.edited_resource:
      self.edited_resource = self.model.copy()
    self.edited_resource["rid"] = text

  def file_selected(self, f):
    if not self.edited_resource:
      self.edited_resource = self.model.copy()

    self.edited_resource["url"] = f
    self.display_resource()
    print "file_accepted"

  def get_dict(self):
    if self.edited_resource:
      return self.edited_resource
示例#8
0
class ResourcesWindow(QtGui.QWidget, Ui_ResourcesWindow):
  def __init__(self, root_dir, *args, **kwargs):
    super(ResourcesWindow, self).__init__(*args, **kwargs)
    self.setupUi(self)
    self.show()
    self.root_dir = root_dir
    self.details_parent = None

  def setDetailsContainer(self, container):
    self.details_parent = container

  def setModel(self, model):
    self.data_model = model
    self.lv_resources.setModel(self.data_model)
    self.lv_resources.set_resource_root(self.root_dir)
    self.lv_resources.doubleClicked.connect(self.__on_resource_edit)
    self.lv_resources.installEventFilter(self)

    #self.lv_resources.key
    self.btn_add.clicked.connect(self.on_add_clicked)
    self.btn_delete.clicked.connect(self.on_remove_clicked)

  def eventFilter(self, sender, event):
    if event.type() == QtCore.QEvent.KeyPress and \
       event.matches(QtGui.QKeySequence.InsertParagraphSeparator) and \
       sender == self.lv_resources:
      self.__on_resource_edit()
    else:
      return super(ResourcesWindow, self).eventFilter(sender, event)

  def __on_resource_edit(self):
    self.edit_index = self.lv_resources.currentIndex()
    self.new_dlg = ResourceDialog(self.root_dir, self.details_parent)
    obj = self.data_model.data(self.edit_index, QtCore.Qt.EditRole)
    self.new_dlg.setModel(obj)
    self.new_dlg.show()
    self.new_dlg.accepted.connect(self.__on_change_accepted)
    self.new_dlg.rejected.connect(self.__on_add_rejected)

  def on_add_clicked(self):
    self.edit_index = None
    self.new_dlg = ResourceDialog(self.root_dir, self.details_parent)
    self.new_dlg.show()
    self.new_dlg.accepted.connect(self.__on_add_accepted)
    self.new_dlg.rejected.connect(self.__on_add_rejected)
    #seld.data_model
    pass

  def __on_add_accepted(self):
    new_res = self.new_dlg.get_dict()
    if new_res:
      self.data_model.appendData(new_res)

  def __on_change_accepted(self):
    new_res = self.new_dlg.get_dict()
    if new_res:
      self.data_model.setData(self.lv_resources.currentIndex(), new_res)


  def __on_add_rejected(self):
    print "add rejected"

  def on_remove_clicked(self):
    self.dialog = ConfirmDialog("Are you sure you want to delete this item")
    self.dialog.accepted.connect(self.on_remove_confirmed)
    self.dialog.rejected.connect(self.on_remove_rejected)
    self.dialog.show()

  def on_remove_confirmed(self):
    print "remove clicked"
    #print "will remove selected resource when implemented"
    print "selected resource is "+str(self.lv_resources.currentIndex().row())
    self.data_model.removeData(self.lv_resources.currentIndex().row())

  def on_remove_rejected(self):
    print "remove cancelled"