コード例 #1
0
ファイル: edgeeditor.py プロジェクト: molock/Space-Train
 def edge_finish(x, y):
     self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
     if self.point_2 and self.point_1 != self.point_2:
         self.editor.change_selection(self)
         self.set_selected_item(
             self.scene.walkpath.add_edge(self.point_1, self.point_2))
     editorstate.set_status_message('')
コード例 #2
0
ファイル: cameraeditor.py プロジェクト: molock/Space-Train
 def new_camera_point(self, button=None):
     editorstate.set_status_message("Click to place a camera point")
     def point_placer(x, y):
         self.editor.change_selection(self)
         self.set_selected_item(self.scene.camera.add_point(x, y))
         editorstate.set_status_message('')
     self.editor.click_actions.append(point_placer)
コード例 #3
0
ファイル: edgeeditor.py プロジェクト: Merfie/Space-Train
 def edge_finish(x, y):
     self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
     if self.point_2:
         self.editor.change_selection(self)
         self.set_selected_item(None)
         self.scene.walkpath.remove_edge(self.point_1, self.point_2)
     editorstate.set_status_message('')
コード例 #4
0
 def actor_button_action(self, button=None):
     def actor_placer(x, y):
         self.dragging_item = self.scene.new_actor(button.text,
                                                   attrs = {'x': x, 'y': y})
         editorstate.set_status_message('')
     self.editor.click_actions.append(actor_placer)
     editorstate.set_status_message("Click to place %s" % button.text)
コード例 #5
0
ファイル: edgeeditor.py プロジェクト: Merfie/Space-Train
 def edge_setup(x, y):
     self.point_1 = self.scene.walkpath.path_point_near_point((x, y))
     if self.point_1:
         editorstate.set_status_message('Click the destination point')
     else:
         # empty the queue, never mind
         self.click_actions = collections.deque()
         editorstate.set_status_message('')
コード例 #6
0
ファイル: edgeeditor.py プロジェクト: molock/Space-Train
 def edge_setup(x, y):
     self.point_1 = self.scene.walkpath.path_point_near_point((x, y))
     if self.point_1:
         editorstate.set_status_message('Click the destination point')
     else:
         # empty the queue, never mind
         self.editor.empty_click_actions()
         editorstate.set_status_message('')
コード例 #7
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def edge_finish(x, y):
     self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
     if not self.point_2:
         self.point_2 = self.scene.walkpath.add_point(x, y)
     if self.point_1 != self.point_2:
         self.editor.change_selection(self.editor.edge_ed)
         new_edge = self.scene.walkpath.add_edge(self.point_1, self.point_2)
         self.editor.edge_ed.set_selected_item(new_edge)
     editorstate.set_status_message('')
コード例 #8
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def wants_drag(self, x, y):
     if self.placing_point:
         self.editor.change_selection(self)
         self.set_selected_item(self.scene.walkpath.add_point(x, y))
         editorstate.set_status_message('')
         return True
     else:
         self.dragging_item = self.scene.walkpath.path_point_near_point((x, y))
         return self.dragging_item is not None
コード例 #9
0
ファイル: pointeditor.py プロジェクト: molock/Space-Train
 def wants_drag(self, x, y):
     if self.placing_point:
         self.editor.change_selection(self)
         self.set_selected_item(self.scene.walkpath.add_point(x, y))
         editorstate.set_status_message('')
         return True
     else:
         self.dragging_item = self.scene.walkpath.path_point_near_point(
             (x, y))
         return self.dragging_item is not None
コード例 #10
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def point_deleter(x, y):
     identifier = self.scene.walkpath.path_point_near_point((x, y))
     self.scene.walkpath.remove_point(identifier)
     to_delete = set()
     for (a, b) in self.scene.walkpath.edges.viewkeys():
         if a == identifier or b == identifier:
             to_delete.add((a, b))
     for x in to_delete:
         print 'deleting', x
         del self.scene.walkpath.edges[x]
     editorstate.set_status_message('')
コード例 #11
0
ファイル: pointeditor.py プロジェクト: molock/Space-Train
 def point_deleter(x, y):
     identifier = self.scene.walkpath.path_point_near_point((x, y))
     self.scene.walkpath.remove_point(identifier)
     to_delete = set()
     for (a, b) in self.scene.walkpath.edges.viewkeys():
         if a == identifier or b == identifier:
             to_delete.add((a, b))
     for x in to_delete:
         print 'deleting', x
         del self.scene.walkpath.edges[x]
     editorstate.set_status_message('')
コード例 #12
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def delete_point(self, button=None):
     self.selected_item = None
     def point_deleter(x, y):
         identifier = self.scene.walkpath.path_point_near_point((x, y))
         self.scene.walkpath.remove_point(identifier)
         to_delete = set()
         for (a, b) in self.scene.walkpath.edges.viewkeys():
             if a == identifier or b == identifier:
                 to_delete.add((a, b))
         for x in to_delete:
             print 'deleting', x
             del self.scene.walkpath.edges[x]
         editorstate.set_status_message('')
     self.editor.click_actions.append(point_deleter)
     editorstate.set_status_message("Click a point to delete it")
コード例 #13
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def new_edge_from_point(self, button=None):
     if not self.selected_item:
         return
     self.point_1 = self.selected_item
     def edge_finish(x, y):
         self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
         if not self.point_2:
             self.point_2 = self.scene.walkpath.add_point(x, y)
         if self.point_1 != self.point_2:
             self.editor.change_selection(self.editor.edge_ed)
             new_edge = self.scene.walkpath.add_edge(self.point_1, self.point_2)
             self.editor.edge_ed.set_selected_item(new_edge)
         editorstate.set_status_message('')
     editorstate.set_status_message('Click to place the destination point')
     self.editor.click_actions.append(edge_finish)
コード例 #14
0
ファイル: pointeditor.py プロジェクト: molock/Space-Train
    def delete_point(self, button=None):
        self.selected_item = None

        def point_deleter(x, y):
            identifier = self.scene.walkpath.path_point_near_point((x, y))
            self.scene.walkpath.remove_point(identifier)
            to_delete = set()
            for (a, b) in self.scene.walkpath.edges.viewkeys():
                if a == identifier or b == identifier:
                    to_delete.add((a, b))
            for x in to_delete:
                print 'deleting', x
                del self.scene.walkpath.edges[x]
            editorstate.set_status_message('')

        self.editor.click_actions.append(point_deleter)
        editorstate.set_status_message("Click a point to delete it")
コード例 #15
0
ファイル: edgeeditor.py プロジェクト: Merfie/Space-Train
 def new_edge(self, button=None):
     editorstate.set_status_message('Click the source point')
     def edge_setup(x, y):
         self.point_1 = self.scene.walkpath.path_point_near_point((x, y))
         if self.point_1:
             editorstate.set_status_message('Click the destination point')
         else:
             # empty the queue, never mind
             self.editor.empty_click_actions()
             editorstate.set_status_message('')
     def edge_finish(x, y):
         self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
         if self.point_2 and self.point_1 != self.point_2:
             self.editor.change_selection(self)
             self.set_selected_item(self.scene.walkpath.add_edge(self.point_1, self.point_2))
         editorstate.set_status_message('')
     self.editor.click_actions.append(edge_setup)
     self.editor.click_actions.append(edge_finish)
コード例 #16
0
ファイル: pointeditor.py プロジェクト: molock/Space-Train
    def new_edge_from_point(self, button=None):
        if not self.selected_item:
            return
        self.point_1 = self.selected_item

        def edge_finish(x, y):
            self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
            if not self.point_2:
                self.point_2 = self.scene.walkpath.add_point(x, y)
            if self.point_1 != self.point_2:
                self.editor.change_selection(self.editor.edge_ed)
                new_edge = self.scene.walkpath.add_edge(
                    self.point_1, self.point_2)
                self.editor.edge_ed.set_selected_item(new_edge)
            editorstate.set_status_message('')

        editorstate.set_status_message('Click to place the destination point')
        self.editor.click_actions.append(edge_finish)
コード例 #17
0
ファイル: edgeeditor.py プロジェクト: molock/Space-Train
    def new_edge(self, button=None):
        editorstate.set_status_message('Click the source point')

        def edge_setup(x, y):
            self.point_1 = self.scene.walkpath.path_point_near_point((x, y))
            if self.point_1:
                editorstate.set_status_message('Click the destination point')
            else:
                # empty the queue, never mind
                self.editor.empty_click_actions()
                editorstate.set_status_message('')

        def edge_finish(x, y):
            self.point_2 = self.scene.walkpath.path_point_near_point((x, y))
            if self.point_2 and self.point_1 != self.point_2:
                self.editor.change_selection(self)
                self.set_selected_item(
                    self.scene.walkpath.add_edge(self.point_1, self.point_2))
            editorstate.set_status_message('')

        self.editor.click_actions.append(edge_setup)
        self.editor.click_actions.append(edge_finish)
コード例 #18
0
ファイル: cameraeditor.py プロジェクト: molock/Space-Train
 def point_placer(x, y):
     self.editor.change_selection(self)
     self.set_selected_item(self.scene.camera.add_point(x, y))
     editorstate.set_status_message('')
コード例 #19
0
ファイル: cameraeditor.py プロジェクト: molock/Space-Train
 def point_deleter(x, y):
     self.scene.camera.remove_point(self.scene.camera.camera_point_near_point((x, y)))
     editorstate.set_status_message('')
コード例 #20
0
ファイル: cameraeditor.py プロジェクト: molock/Space-Train
 def delete_camera_point(self, button=None):
     def point_deleter(x, y):
         self.scene.camera.remove_point(self.scene.camera.camera_point_near_point((x, y)))
         editorstate.set_status_message('')
     self.editor.click_actions.append(point_deleter)
     editorstate.set_status_message("Click a camera point to delete it")
コード例 #21
0
ファイル: pointeditor.py プロジェクト: molock/Space-Train
 def new_point(self, button=None):
     editorstate.set_status_message("Click to place a point")
     self.placing_point = True
コード例 #22
0
ファイル: pointeditor.py プロジェクト: Merfie/Space-Train
 def new_point(self, button=None):
     editorstate.set_status_message("Click to place a point")
     self.placing_point = True
コード例 #23
0
 def actor_placer(x, y):
     self.dragging_item = self.scene.new_actor(button.text,
                                               attrs = {'x': x, 'y': y})
     editorstate.set_status_message('')