Ejemplo n.º 1
0
            def revert_changes(msg, history):
                history.project.file = history.file
                history.project.lastEdited = history.editDate
                history.project.image = history.image
                Container.save(history.project)
                msg.destroy()

                for li in self.historyItems:
                    if li.dataObject.editDate >= history.editDate:
                        Container.deleteObject(li.dataObject)
                        li.destroy()

                photo = getdisplayableimage(history.image,
                                            (self.frm_preview.winfo_width(),
                                             self.frm_preview.winfo_height()))
                self.lbl_image.configure(image=photo)
                self.lbl_image.image = photo

                MessageModal(
                    self,
                    title=f'Success',
                    message=
                    f'Changes reverted to the following date:\n{history.editDate.strftime("%x - %X")}!',
                    messageType='info')
                getattr(
                    self, 'lbl_' + CollaborationWindow.lblSettings[2]['prop']
                )['text'] = history.editDate.strftime(
                    "%d/%m/%Y"
                ) if datetime.datetime.now(
                ).strftime("%x") != history.editDate.strftime(
                    "%x") else 'Today at - ' + history.editDate.strftime("%X")
Ejemplo n.º 2
0
 def generate_link(msg2, modal, slink, privilege):
     msg2.destroy()
     if slink != None: Container.deleteObject(slink)
     link= f'bpmntool//{dataObject.title}/{datetime.now()}/'
     Container.save(ShareLink(link=link, expirationDate=datetime.now()+timedelta(days=1), privilege= privilege, project=dataObject))
     self.clean_notifications()
     set_link(link)
Ejemplo n.º 3
0
 def clean_notifications(self):
     notifs = Container.filter(Notification)
     for notif in notifs:
         if notif.nature == NotificationNature.INV.value and Container.filter(Invitation, Invitation.id == notif.invitationId).first() == None:
             Container.deleteObject(notif)
         elif notif.nature == NotificationNature.INVLINK.value:
             invitationLink = Container.filter(InvitationLink, InvitationLink.id == notif.invitationId).first()
             if invitationLink == None or Container.filter(Collaboration, Collaboration.sessionId == invitationLink.sessionId, Collaboration.userId == notif.actorId).first() == None: Container.deleteObject(notif)
         elif notif.nature == NotificationNature.SHARELINK.value and Container.filter(ShareLink, ShareLink.id == notif.invitationId).first() == None:
             Container.deleteObject(notif)
Ejemplo n.º 4
0
 def generate_link(msg2, modal, inv, privilege):
     msg2.destroy()
     if inv != None: Container.deleteObject(inv)
     link = f'bpmntool//{self.session.title}/{datetime.datetime.now()}/'
     Container.save(
         InvitationLink(link=link,
                        expirationDate=datetime.datetime.now() +
                        datetime.timedelta(days=1),
                        privilege=privilege,
                        sender=CollaborationWindow.ACTIVE_USER,
                        session=self.session))
     self.clean_notifications()
     set_link(link)
Ejemplo n.º 5
0
        def delete_relation(relation):
            # delete relation
            Container.deleteObject(relation)
            # destroy message
            msg.destroy()
            # remove deleted collaborator's listItem
            for li in self.collaboratorsItems:
                if li.dataObject == relation:
                    li.destroy()
                    # self.collaboratorItems.remove(li)

            self.refresh_window(
                f'{relation.userTwo.userName} has been removed succefully!')
Ejemplo n.º 6
0
        def delete_collaboration(user):
            Container.deleteObject(
                Container.filter(
                    Collaboration, Collaboration.userId == user.id,
                    Collaboration.sessionId == self.session.id).first())
            msg.destroy()
            for li in self.collaboratorItems:
                if li.dataObject == user:
                    li.destroy()
                    getattr(
                        self,
                        'lbl_' + CollaborationWindow.lblSettings[3]['prop']
                    )['text'] = str(
                        Container.filter(
                            Collaboration, Collaboration.sessionId ==
                            self.session.id).count() + 1)

            MessageModal(
                self,
                title=f'Success',
                message=f'{user.userName} has been kicked out of the session!',
                messageType='info')
Ejemplo n.º 7
0
 def delete(self, dataObject):
     Container.deleteObject(dataObject)
     self.clean_notifications()
     self.refresh_window()
Ejemplo n.º 8
0
 def delete_session(self):
     Container.deleteObject(self.session.project)
     self.clean_notifications()
     self.windowManager.run_tag('home')
     self.destroy()