예제 #1
0
    def on_left_up(self, event):
        loc = -1
        self.scroll_x, self.scroll_y = 0, 0

        if (self.drag_image):
            pt = event.GetPosition()
            loc, update, which_id = self.local_move_centre_pt(
                pt, self.drag_name, self.drag_image)

            self.drag_bmp = None
            self.drag_image.Hide()
            self.drag_image.EndDrag()
            self.drag_image = None

            if (loc == -1):
                win_data.selection_drop_all()
                if (not win_data.get_ok_to_delete("Program")):
                    win_data.program().abort_move()
                else:
                    win_data.program().end_move(loc, which_id)
                    self.big_x = -1
                    self.Refresh(True)
                    self.Update()
            else:
                win_data.program().end_move(loc, which_id)
                win_data.click_sound()

        # force the work area to redraw
        self.SetCursor(wx.NullCursor)
        self.Refresh()
예제 #2
0
    def on_left_up(self, event):
        loc = -1
        if (self.drag_image):
            pt = event.GetPosition()
            loc, update, dummy = self.local_move_centre_pt(
                pt, self.drag_name, self.drag_image)

            self.drag_bmp = None
            self.drag_image.Hide()
            self.drag_image.EndDrag()
            self.drag_image = None

            # check if we are removing it, is the program using it?
            if (win_data.config_check(loc, self.drag_name)):
                win_data.config_move_end(loc)
                win_data.click_sound()
            else:
                if (win_data.get_ok_to_delete("Module")):
                    if (not win_data.config_move_to_trash()):
                        # can't drop it - put it back
                        error_message="Can not delete the device as it is used in the program.\n" +\
                                       "Delete it from the program before deleting it here."
                        wx.MessageBox(error_message,
                                      caption="Can't delete device.",
                                      style=wx.OK | wx.ICON_ERROR)

                        win_data.config_move_abort()
                else:
                    win_data.config_move_abort()

        # force the work area to redraw
        self.SetCursor(wx.NullCursor)
        self.Refresh()
        win_data.force_redraw('config')
예제 #3
0
    def on_left_up(self, event):
        # do parent processing
        loc, name, dummy = self.parent_on_left_up(event)
        if (loc >= 0):
            # it is a valid drop!
            win_data.config_add(loc, name)
            win_data.selection_take('cwork', name, loc)
            win_data.click_sound()

        # force the work area to redraw
        win_data.force_redraw('cwork')
        win_data.force_redraw('config')