def __init__(self, main_window): GooCanvas.Canvas.__init__(self) DiagramModel.__init__(self) self.set_property("expand", True) self.set_property("has-tooltip", True) # Allow tooltip on elements self.set_property("background-color", "White") self.set_property("clear-background", True) Gtk.Widget.grab_focus(self) self.last_clicked_point = (None, None) self.main_window = main_window self.curr_connector = None self.connect("motion-notify-event", self.__on_motion_notify) self.connect_after("button_press_event", self.__on_button_press) self.connect_after("button_release_event", self.__on_button_release) self.connect_after("key-press-event", self.__on_key_press) self.connect("drag_data_received", self.__drag_data_received) self.drag_dest_set( Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 1)], Gdk.DragAction.DEFAULT | Gdk.DragAction.COPY) self.show_grid = False self.select_rect = None self.__draw_grid() # Used for cycle detection self.show()
def __init__(self, main_window): GooCanvas.Canvas.__init__(self) DiagramModel.__init__(self) self.set_property("expand", True) self.last_clicked_point = (None, None) self.main_window = main_window self.curr_connector = None self.current_widgets = [] self.grab_focus() self.connect("motion-notify-event", self.__on_motion_notify) self.connect_after("button_press_event", self.__on_button_press) self.connect_after("button_release_event", self.__on_button_release) self.connect_after("key-press-event", self.__on_key_press) self.connect("drag_data_received", self.__drag_data_received) self.drag_dest_set( Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 1)], Gdk.DragAction.DEFAULT | Gdk.DragAction.COPY) self.white_board = None self.show_grid = False self.select_rect = None self.__update_white_board() self.scrolled_window = None self.set_property("has-tooltip", True) # Allow tooltip on elements self.show() self.language = "" #self.file_name = "" # Used for cycle detection self.__marks = None
def test_init(self): model = DiagramModel() str(model) model.file_name = "/tmp/test.mscd" self.assertEqual("test", model.patch_name)
def test_init(self): model = DiagramModel() self.assertEqual("Untitled", model.patch_name)
def setUp(self): """Do the test basic setup.""" self.diagram_model = DiagramModel()