Ejemplo n.º 1
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Preferences.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((395, 424))
        self.combobox_board = wx.ComboBox(
            self,
            wx.ID_ANY,
            choices=["M2", "B2", "M", "M1", "A", "B", "B1"],
            style=wx.CB_DROPDOWN)
        self.checkbox_flip_x = wx.CheckBox(self, wx.ID_ANY, _("Flip X"))
        self.checkbox_home_right = wx.CheckBox(self, wx.ID_ANY,
                                               _("Homes Right"))
        self.checkbox_flip_y = wx.CheckBox(self, wx.ID_ANY, _("Flip Y"))
        self.checkbox_home_bottom = wx.CheckBox(self, wx.ID_ANY,
                                                _("Homes Bottom"))
        self.checkbox_swap_xy = wx.CheckBox(self, wx.ID_ANY, _("Swap X and Y"))
        self.checkbox_mock_usb = wx.CheckBox(self, wx.ID_ANY,
                                             _("Mock USB Connection Mode"))
        self.spin_device_index = wx.SpinCtrl(self,
                                             wx.ID_ANY,
                                             "-1",
                                             min=-1,
                                             max=5)
        self.spin_device_address = wx.SpinCtrl(self,
                                               wx.ID_ANY,
                                               "-1",
                                               min=-1,
                                               max=5)
        self.spin_device_bus = wx.SpinCtrl(self,
                                           wx.ID_ANY,
                                           "-1",
                                           min=-1,
                                           max=5)
        self.spin_device_version = wx.SpinCtrl(self,
                                               wx.ID_ANY,
                                               "-1",
                                               min=-1,
                                               max=255)
        self.spin_home_x = wx.SpinCtrlDouble(self,
                                             wx.ID_ANY,
                                             "0.0",
                                             min=-50000.0,
                                             max=50000.0)
        self.spin_home_y = wx.SpinCtrlDouble(self,
                                             wx.ID_ANY,
                                             "0.0",
                                             min=-50000.0,
                                             max=50000.0)
        self.button_home_by_current = wx.Button(self, wx.ID_ANY,
                                                _("Set Current"))
        self.spin_bedwidth = wx.SpinCtrlDouble(self,
                                               wx.ID_ANY,
                                               "330.0",
                                               min=1.0,
                                               max=1000.0)
        self.spin_bedheight = wx.SpinCtrlDouble(self,
                                                wx.ID_ANY,
                                                "230.0",
                                                min=1.0,
                                                max=1000.0)
        self.checkbox_autolock = wx.CheckBox(self, wx.ID_ANY,
                                             _("Automatically lock rail"))
        self.checkbox_autohome = wx.CheckBox(self, wx.ID_ANY,
                                             _("Home after job complete"))
        self.checkbox_autobeep = wx.CheckBox(self, wx.ID_ANY,
                                             _("Beep after job complete"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_combobox_boardtype,
                  self.combobox_board)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_swap_xy,
                  self.checkbox_swap_xy)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_flip_x, self.checkbox_flip_x)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_home_right,
                  self.checkbox_home_right)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_flip_y, self.checkbox_flip_y)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_home_bottom,
                  self.checkbox_home_bottom)
        self.Bind(wx.EVT_CHECKBOX, self.on_checkbox_mock_usb,
                  self.checkbox_mock_usb)
        self.Bind(wx.EVT_SPINCTRL, self.spin_on_device_index,
                  self.spin_device_index)
        self.Bind(wx.EVT_TEXT, self.spin_on_device_index,
                  self.spin_device_index)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_device_index,
                  self.spin_device_index)
        self.Bind(wx.EVT_SPINCTRL, self.spin_on_device_address,
                  self.spin_device_address)
        self.Bind(wx.EVT_TEXT, self.spin_on_device_address,
                  self.spin_device_address)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_device_address,
                  self.spin_device_address)
        self.Bind(wx.EVT_SPINCTRL, self.spin_on_device_bus,
                  self.spin_device_bus)
        self.Bind(wx.EVT_TEXT, self.spin_on_device_bus, self.spin_device_bus)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_device_bus,
                  self.spin_device_bus)
        self.Bind(wx.EVT_SPINCTRL, self.spin_on_device_version,
                  self.spin_device_version)
        self.Bind(wx.EVT_TEXT, self.spin_on_device_version,
                  self.spin_device_version)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_device_version,
                  self.spin_device_version)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.spin_on_home_x, self.spin_home_x)
        self.Bind(wx.EVT_TEXT, self.spin_on_home_x, self.spin_home_x)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_home_x, self.spin_home_x)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.spin_on_home_y, self.spin_home_y)
        self.Bind(wx.EVT_TEXT, self.spin_on_home_y, self.spin_home_y)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_home_y, self.spin_home_y)
        self.Bind(wx.EVT_BUTTON, self.on_button_set_home_current,
                  self.button_home_by_current)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.spin_on_bedwidth,
                  self.spin_bedwidth)
        self.Bind(wx.EVT_TEXT, self.spin_on_bedwidth, self.spin_bedwidth)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_bedwidth, self.spin_bedwidth)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.spin_on_bedheight,
                  self.spin_bedheight)
        self.Bind(wx.EVT_TEXT, self.spin_on_bedheight, self.spin_bedheight)
        self.Bind(wx.EVT_TEXT_ENTER, self.spin_on_bedheight,
                  self.spin_bedheight)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_autolock,
                  self.checkbox_autolock)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_autohome,
                  self.checkbox_autohome)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_autobeep,
                  self.checkbox_autobeep)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        # OSX Window close
        if parent is not None:
            parent.accelerator_table(self)
Ejemplo n.º 2
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Alignment.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((631, 365))

        self.spin_vertical_distance = wx.SpinCtrl(self,
                                                  wx.ID_ANY,
                                                  "180",
                                                  min=10,
                                                  max=400)
        self.spin_vertical_power = wx.SpinCtrl(self,
                                               wx.ID_ANY,
                                               "180",
                                               min=10,
                                               max=500)
        self.check_vertical_done = wx.CheckBox(
            self, wx.ID_ANY, _("Vertical Alignment Finished"))
        self.spin_horizontal_distance = wx.SpinCtrl(self,
                                                    wx.ID_ANY,
                                                    "220",
                                                    min=10,
                                                    max=400)
        self.spin_horizontal_power = wx.SpinCtrl(self,
                                                 wx.ID_ANY,
                                                 "180",
                                                 min=10,
                                                 max=500)
        self.check_horizontal_done = wx.CheckBox(
            self, wx.ID_ANY, _("Horizontal Alignment Finished"))
        self.slider_square_power = wx.Slider(self,
                                             wx.ID_ANY,
                                             200,
                                             0,
                                             1000,
                                             style=wx.SL_HORIZONTAL
                                             | wx.SL_LABELS)

        self.button_vertical_align_nearfar = wx.BitmapButton(
            self, wx.ID_ANY, icons8_resize_vertical_50.GetBitmap())
        self.button_horizontal_align_nearfar = wx.BitmapButton(
            self, wx.ID_ANY, icons8_resize_horizontal_50.GetBitmap())
        self.button_vertical_align = wx.BitmapButton(
            self, wx.ID_ANY, icons8_resize_vertical_50.GetBitmap())
        self.button_horizontal_align = wx.BitmapButton(
            self, wx.ID_ANY, icons8_resize_horizontal_50.GetBitmap())
        self.button_square_align_4_corner = wx.BitmapButton(
            self, wx.ID_ANY, icons8_stop_50.GetBitmap())
        self.button_square_align = wx.BitmapButton(self, wx.ID_ANY,
                                                   icons8_stop_50.GetBitmap())

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_button_vertical_align_nearfar,
                  self.button_vertical_align_nearfar)
        self.Bind(wx.EVT_BUTTON, self.on_button_vertical_align,
                  self.button_vertical_align)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin_vertical_distance,
                  self.spin_vertical_distance)
        self.Bind(wx.EVT_TEXT, self.on_spin_vertical_distance,
                  self.spin_vertical_distance)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_vertical_distance,
                  self.spin_vertical_distance)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin_vertical_power,
                  self.spin_vertical_power)
        self.Bind(wx.EVT_TEXT, self.on_spin_vertical_power,
                  self.spin_vertical_power)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_vertical_power,
                  self.spin_vertical_power)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_vertical_done,
                  self.check_vertical_done)
        self.Bind(wx.EVT_BUTTON, self.on_button_horizontal_align_nearfar,
                  self.button_horizontal_align_nearfar)
        self.Bind(wx.EVT_BUTTON, self.on_button_horizontal_align,
                  self.button_horizontal_align)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin_horizontal_distance,
                  self.spin_horizontal_distance)
        self.Bind(wx.EVT_TEXT, self.on_spin_horizontal_distance,
                  self.spin_horizontal_distance)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_horizontal_distance,
                  self.spin_horizontal_distance)
        self.Bind(wx.EVT_SPINCTRL, self.on_spin_horizontal_power,
                  self.spin_horizontal_power)
        self.Bind(wx.EVT_TEXT, self.on_spin_horizontal_power,
                  self.spin_horizontal_power)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_horizontal_power,
                  self.spin_horizontal_power)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_horizontal_done,
                  self.check_horizontal_done)
        self.Bind(wx.EVT_BUTTON, self.on_button_square_align_4_corners,
                  self.button_square_align_4_corner)
        self.Bind(wx.EVT_BUTTON, self.on_button_square_align,
                  self.button_square_align)
        self.Bind(wx.EVT_COMMAND_SCROLL, self.on_slider_square_power_change,
                  self.slider_square_power)
        self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED,
                  self.on_slider_square_power_change, self.slider_square_power)

        self.Bind(wx.EVT_CLOSE, self.on_close, self)
Ejemplo n.º 3
0
    def __init__(self, parent, *args, **kwds):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        if args >= 1:
            self.settings_value = args[0]
        else:
            self.settings_value = 0
        self.SetSize((600, 600))
        self.CameraInterface_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Reset Perspective"), "")
        self.Bind(wx.EVT_MENU, self.reset_perspective, id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Reset Fisheye"), "")
        self.Bind(wx.EVT_MENU, self.reset_fisheye, id=item.GetId())
        wxglade_tmp_menu.AppendSeparator()

        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set URI"), "")
        self.Bind(wx.EVT_MENU, lambda e: self.ip_menu_edit(), id=item.GetId())

        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set IP Camera"), "",
                                       wx.ITEM_RADIO)
        self.ip_camera_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(-1), id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set Camera 0"), "",
                                       wx.ITEM_RADIO)
        self.camera_0_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(0), id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set Camera 1"), "",
                                       wx.ITEM_RADIO)
        self.camera_1_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(1), id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set Camera 2"), "",
                                       wx.ITEM_RADIO)
        self.camera_2_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(2), id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set Camera 3"), "",
                                       wx.ITEM_RADIO)
        self.camera_3_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(3), id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, _("Set Camera 4"), "",
                                       wx.ITEM_RADIO)
        self.camera_4_menu = item
        self.Bind(wx.EVT_MENU, lambda e: self.swap_camera(4), id=item.GetId())

        self.CameraInterface_menubar.Append(wxglade_tmp_menu, _("Camera"))
        self.SetMenuBar(self.CameraInterface_menubar)
        # Menu Bar

        self.button_update = wx.BitmapButton(self, wx.ID_ANY,
                                             icons8_camera_50.GetBitmap())
        self.button_export = wx.BitmapButton(
            self, wx.ID_ANY,
            icons8_picture_in_picture_alternative_50.GetBitmap())
        self.button_reconnect = wx.BitmapButton(
            self, wx.ID_ANY, icons8_connected_50.GetBitmap())
        self.check_fisheye = wx.CheckBox(self, wx.ID_ANY, _("Correct Fisheye"))
        self.check_perspective = wx.CheckBox(self, wx.ID_ANY,
                                             _("Correct Perspective"))
        self.slider_fps = wx.Slider(self,
                                    wx.ID_ANY,
                                    24,
                                    0,
                                    60,
                                    style=wx.SL_AUTOTICKS | wx.SL_HORIZONTAL
                                    | wx.SL_LABELS)
        self.button_detect = wx.BitmapButton(self, wx.ID_ANY,
                                             icons8_detective_50.GetBitmap())
        self.display_camera = wx.Panel(self, wx.ID_ANY)
        self.__set_properties()
        self.__do_layout()

        self.camera_job = None
        self.fetch_job = None
        self.camera_setting = None
        self.setting = None

        self.current_frame = None
        self.last_frame = None

        self.current_raw = None
        self.last_raw = None

        self.capture = None
        self.image_width = -1
        self.image_height = -1
        self._Buffer = None

        self.frame_bitmap = None

        self.fisheye_k = None
        self.fisheye_d = None

        # Used during calibration.
        self.objpoints = []  # 3d point in real world space
        self.imgpoints = []  # 2d points in image plane.

        # Perspective Points
        self.perspective = None

        self.previous_window_position = None
        self.previous_scene_position = None

        self.corner_drag = None

        self.matrix = Matrix()

        self.Bind(wx.EVT_BUTTON, self.on_button_update, self.button_update)
        self.Bind(wx.EVT_BUTTON, self.on_button_export, self.button_export)
        self.Bind(wx.EVT_BUTTON, self.on_button_reconnect,
                  self.button_reconnect)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_fisheye, self.check_fisheye)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_perspective,
                  self.check_perspective)
        self.Bind(wx.EVT_SLIDER, self.on_slider_fps, self.slider_fps)
        self.Bind(wx.EVT_BUTTON, self.on_button_detect, self.button_detect)
        self.SetDoubleBuffered(True)
        # end wxGlade

        self.display_camera.Bind(wx.EVT_PAINT, self.on_paint)
        self.display_camera.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase)
        self.display_camera.Bind(wx.EVT_MOTION, self.on_mouse_move)
        self.display_camera.Bind(wx.EVT_MOUSEWHEEL, self.on_mousewheel)
        self.display_camera.Bind(wx.EVT_MIDDLE_UP, self.on_mouse_middle_up)
        self.display_camera.Bind(wx.EVT_MIDDLE_DOWN, self.on_mouse_middle_down)

        self.display_camera.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down)
        self.display_camera.Bind(wx.EVT_LEFT_UP, self.on_mouse_left_up)
        self.display_camera.Bind(wx.EVT_ENTER_WINDOW,
                                 lambda event: self.display_camera.SetFocus(
                                 ))  # Focus follows mouse.
        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        self.on_size(None)
        self.Bind(wx.EVT_SIZE, self.on_size, self)
        self.camera_lock = threading.Lock()
        self.process = self.update_view
        self.connection_attempts = 0
        self.frame_attempts = 0
        self.last_frame_index = -1
        self.frame_index = 0
        self.quit_thread = False
Ejemplo n.º 4
0
    def __init__(self, parent, *args, **kwds):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((424, 417))
        self.check_speed_override = wx.CheckBox(self, wx.ID_ANY, "")
        self.slider_speed_override = wx.Slider(
            self,
            wx.ID_ANY,
            100,
            0,
            500,
            style=wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.check_power_override = wx.CheckBox(self, wx.ID_ANY, "")
        self.slider_power_override = wx.Slider(
            self,
            wx.ID_ANY,
            1000,
            0,
            1000,
            style=wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.check_overscan_override = wx.CheckBox(self, wx.ID_ANY, "")
        self.slider_overscan_override = wx.Slider(
            self,
            wx.ID_ANY,
            0,
            0,
            2000,
            style=wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.check_speed_ratio = wx.CheckBox(self, wx.ID_ANY, "")
        self.slider_speed_ratio = wx.Slider(self,
                                            wx.ID_ANY,
                                            100,
                                            0,
                                            500,
                                            style=wx.SL_AUTOTICKS
                                            | wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.check_power_ratio = wx.CheckBox(self, wx.ID_ANY, "")
        self.slider_power_ratio = wx.Slider(self,
                                            wx.ID_ANY,
                                            100,
                                            0,
                                            200,
                                            style=wx.SL_AUTOTICKS
                                            | wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.checkbox_pattern_group = wx.CheckBox(self, wx.ID_ANY,
                                                  _("Group Pulses"))
        self.button_up = wx.BitmapButton(self, wx.ID_ANY, icons8up.GetBitmap())
        self.button_left = wx.BitmapButton(self, wx.ID_ANY,
                                           icons8_left.GetBitmap())
        self.button_origin = wx.BitmapButton(
            self, wx.ID_ANY, icons8_center_of_gravity_50.GetBitmap())
        self.button_right = wx.BitmapButton(self, wx.ID_ANY,
                                            icons8_right.GetBitmap())
        self.button_down = wx.BitmapButton(self, wx.ID_ANY,
                                           icons8_down.GetBitmap())
        self.bitmap_flush_buffer = wx.BitmapButton(self, wx.ID_ANY,
                                                   icons8_goal_50.GetBitmap())
        self.bitmap_cancel = wx.BitmapButton(self, wx.ID_ANY,
                                             icons8_delete_50.GetBitmap())
        self.bitmap_stop = wx.BitmapButton(self, wx.ID_ANY,
                                           icons8_stop_sign_50.GetBitmap())
        self.text_status_information = wx.TextCtrl(self,
                                                   wx.ID_ANY,
                                                   "",
                                                   style=wx.TE_MULTILINE)

        self.__set_properties()
        self.__do_layout()

        self.Bind(
            wx.EVT_CHECKBOX, lambda e: self.slider_speed_override.Enable(
                self.check_speed_override.GetValue()),
            self.check_speed_override)
        self.Bind(wx.EVT_SLIDER, self.on_slider_speed_override,
                  self.slider_speed_override)
        self.Bind(
            wx.EVT_CHECKBOX, lambda e: self.slider_power_override.Enable(
                self.check_power_override.GetValue()),
            self.check_power_override)
        self.Bind(wx.EVT_SLIDER, self.on_slider_power_override,
                  self.slider_power_override)
        self.Bind(
            wx.EVT_CHECKBOX, lambda e: self.slider_overscan_override.Enable(
                self.check_overscan_override.GetValue()),
            self.check_overscan_override)
        self.Bind(wx.EVT_SLIDER, self.on_slider_overscan_override,
                  self.slider_overscan_override)
        self.Bind(
            wx.EVT_CHECKBOX, lambda e: self.slider_speed_ratio.Enable(
                self.check_speed_ratio.GetValue()), self.check_speed_ratio)
        self.Bind(wx.EVT_SLIDER, self.on_slider_speed_ratio,
                  self.slider_speed_ratio)
        self.Bind(
            wx.EVT_CHECKBOX, lambda e: self.slider_power_ratio.Enable(
                self.check_power_ratio.GetValue()), self.check_power_ratio)
        self.Bind(wx.EVT_SLIDER, self.on_slider_power_ratio,
                  self.slider_power_ratio)
        self.Bind(wx.EVT_CHECKBOX, self.on_check_pattern_group,
                  self.checkbox_pattern_group)
        self.Bind(wx.EVT_BUTTON, self.on_button_adjust_top, self.button_up)
        self.Bind(wx.EVT_BUTTON, self.on_button_adjust_left, self.button_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_adjust_origin,
                  self.button_origin)
        self.Bind(wx.EVT_BUTTON, self.on_button_adjust_right,
                  self.button_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_adjust_bottom,
                  self.button_down)
        self.Bind(wx.EVT_BUTTON, self.on_button_flush_buffer,
                  self.bitmap_flush_buffer)
        self.Bind(wx.EVT_BUTTON, self.on_button_safe_quit, self.bitmap_cancel)
        self.Bind(wx.EVT_BUTTON, self.on_button_emergency_exit,
                  self.bitmap_stop)
        self.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
        self.SetFocus()
Ejemplo n.º 5
0
 def __init__(self):
     Module.__init__(self)
     Backend.__init__(self, uid='K40Stock')
     self.autolock = True
     self.mock = True
Ejemplo n.º 6
0
    def __init__(self, parent, element=None, *args, **kwds):
        # begin wxGlade: PathProperty.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((288, 303))
        self.text_name = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_stroke_none = wx.Button(self, wx.ID_ANY, _("None"))
        self.button_stroke_none.name = "stroke none"
        self.button_stroke_F00 = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_F00.name = "stroke #F00"
        self.button_stroke_0F0 = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_0F0.name = "stroke #0F0"
        self.button_stroke_00F = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_00F.name = "stroke #00F"
        self.button_stroke_F0F = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_F0F.name = "stroke #F0F"
        self.button_stroke_0FF = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_0FF.name = "stroke #0FF"
        self.button_stroke_FF0 = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_FF0.name = "stroke #FF0"
        self.button_stroke_000 = wx.Button(self, wx.ID_ANY, "")
        self.button_stroke_000.name = "stroke #000"

        self.button_fill_none = wx.Button(self, wx.ID_ANY, _("None"))
        self.button_fill_none.name = "fill none"
        self.button_fill_F00 = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_F00.name = "fill #F00"
        self.button_fill_0F0 = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_0F0.name = "fill #0F0"
        self.button_fill_00F = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_00F.name = "fill #00F"
        self.button_fill_F0F = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_F0F.name = "fill #F0F"
        self.button_fill_0FF = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_0FF.name = "fill #0FF"
        self.button_fill_FF0 = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_FF0.name = "fill #FF0"
        self.button_fill_000 = wx.Button(self, wx.ID_ANY, "")
        self.button_fill_000.name = "fill #000"

        self.__set_properties()
        self.__do_layout()
        try:
            if element.id is not None:
                self.text_name.SetValue(str(element.id))
        except AttributeError:
            pass
        self.Bind(wx.EVT_TEXT, self.on_text_name_change, self.text_name)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_name_change, self.text_name)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_none)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_F00)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_0F0)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_00F)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_F0F)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_0FF)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_FF0)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_stroke_000)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_none)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_F00)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_0F0)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_00F)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_F0F)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_0FF)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_FF0)
        self.Bind(wx.EVT_BUTTON, self.on_button_color, self.button_fill_000)
        # end wxGlade
        self.path_element = element
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
Ejemplo n.º 7
0
 def initialize(self, kernel, name=None):
     Module.initialize(kernel, name)
     self.kernel = kernel
     self.name = name
Ejemplo n.º 8
0
 def shutdown(self, kernel):
     Module.shutdown(self, kernel)
Ejemplo n.º 9
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Navigation.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((598, 429))
        self.spin_jog_mils = wx.SpinCtrlDouble(self,
                                               wx.ID_ANY,
                                               "394.0",
                                               min=0.0,
                                               max=10000.0)
        self.spin_jog_mm = wx.SpinCtrlDouble(self,
                                             wx.ID_ANY,
                                             "10.0",
                                             min=0.0,
                                             max=254.0)
        self.spin_jog_cm = wx.SpinCtrlDouble(self,
                                             wx.ID_ANY,
                                             "1.0",
                                             min=0.0,
                                             max=25.4)
        self.spin_jog_inch = wx.SpinCtrlDouble(self,
                                               wx.ID_ANY,
                                               "0.394",
                                               min=0.0,
                                               max=10.0)
        self.button_navigate_up_left = wx.BitmapButton(
            self, wx.ID_ANY, icons8_up_left_50.GetBitmap())
        self.button_navigate_up = wx.BitmapButton(self, wx.ID_ANY,
                                                  icons8_up_50.GetBitmap())
        self.button_navigate_up_right = wx.BitmapButton(
            self, wx.ID_ANY, icons8_up_right_50.GetBitmap())
        self.button_navigate_left = wx.BitmapButton(self, wx.ID_ANY,
                                                    icons8_left_50.GetBitmap())
        self.button_navigate_home = wx.BitmapButton(
            self, wx.ID_ANY, icons8_home_filled_50.GetBitmap())
        self.button_navigate_right = wx.BitmapButton(
            self, wx.ID_ANY, icons8_right_50.GetBitmap())
        self.button_navigate_down_left = wx.BitmapButton(
            self, wx.ID_ANY, icons8_down_left_50.GetBitmap())
        self.button_navigate_down = wx.BitmapButton(self, wx.ID_ANY,
                                                    icons8_down_50.GetBitmap())
        self.button_navigate_down_right = wx.BitmapButton(
            self, wx.ID_ANY, icons8_down_right_50.GetBitmap())
        self.button_navigate_unlock = wx.BitmapButton(
            self, wx.ID_ANY, icons8_padlock_50.GetBitmap())
        self.button_navigate_lock = wx.BitmapButton(self, wx.ID_ANY,
                                                    icons8_lock_50.GetBitmap())
        self.button_align_corner_top_left = wx.BitmapButton(
            self, wx.ID_ANY, icon_corner1.GetBitmap())
        self.button_align_drag_up = wx.BitmapButton(self, wx.ID_ANY,
                                                    icons8up.GetBitmap())
        self.button_align_corner_top_right = wx.BitmapButton(
            self, wx.ID_ANY, icon_corner2.GetBitmap())
        self.button_align_drag_left = wx.BitmapButton(self, wx.ID_ANY,
                                                      icons8_left.GetBitmap())
        self.button_align_center = wx.BitmapButton(
            self, wx.ID_ANY, icons8_square_border_50.GetBitmap())
        self.button_align_drag_right = wx.BitmapButton(
            self, wx.ID_ANY, icons8_right.GetBitmap())
        self.button_align_corner_bottom_left = wx.BitmapButton(
            self, wx.ID_ANY, icon_corner4.GetBitmap())
        self.button_align_drag_down = wx.BitmapButton(self, wx.ID_ANY,
                                                      icons8_down.GetBitmap())
        self.button_align_corner_bottom_right = wx.BitmapButton(
            self, wx.ID_ANY, icon_corner3.GetBitmap())
        self.button_align_first_position = wx.BitmapButton(
            self, wx.ID_ANY, icons8_level_1_50.GetBitmap())
        self.button_align_trace_hull = wx.BitmapButton(
            self, wx.ID_ANY, icons8_pentagon_50.GetBitmap())
        self.button_align_trace_quick = wx.BitmapButton(
            self, wx.ID_ANY, icons8_pentagon_square_50.GetBitmap())
        self.button_scale_down = wx.BitmapButton(
            self, wx.ID_ANY, icons8_compress_50.GetBitmap())
        self.button_translate_up = wx.BitmapButton(self, wx.ID_ANY,
                                                   icons8_up_50.GetBitmap())
        self.button_scale_up = wx.BitmapButton(self, wx.ID_ANY,
                                               icons8_enlarge_50.GetBitmap())
        self.button_translate_left = wx.BitmapButton(
            self, wx.ID_ANY, icons8_left_50.GetBitmap())
        self.button_reset = wx.BitmapButton(self, wx.ID_ANY,
                                            icons8_delete_50.GetBitmap())
        self.button_translate_right = wx.BitmapButton(
            self, wx.ID_ANY, icons8_right_50.GetBitmap())
        self.button_rotate_ccw = wx.BitmapButton(
            self, wx.ID_ANY, icons8_rotate_left_50.GetBitmap())
        self.button_translate_down = wx.BitmapButton(
            self, wx.ID_ANY, icons8_down_50.GetBitmap())
        self.button_rotate_cw = wx.BitmapButton(
            self, wx.ID_ANY, icons8_rotate_right_50.GetBitmap())
        self.text_a = wx.TextCtrl(self, wx.ID_ANY, "1.000000")
        self.text_c = wx.TextCtrl(self, wx.ID_ANY, "0.000000")
        self.text_d = wx.TextCtrl(self, wx.ID_ANY, "1.000000")
        self.text_b = wx.TextCtrl(self, wx.ID_ANY, "0.000000")
        self.text_e = wx.TextCtrl(self, wx.ID_ANY, "0.000000")
        self.text_f = wx.TextCtrl(self, wx.ID_ANY, "0.000000")

        self.button_navigate_pulse = wx.BitmapButton(
            self, wx.ID_ANY, icons8_laser_beam_52.GetBitmap())
        self.spin_pulse_duration = wx.SpinCtrl(self,
                                               wx.ID_ANY,
                                               "50",
                                               min=1,
                                               max=1000)
        self.button_navigate_move_to = wx.BitmapButton(
            self, wx.ID_ANY, icons8_center_of_gravity_50.GetBitmap())
        self.text_position_x = wx.TextCtrl(self, wx.ID_ANY, "0")
        self.text_position_y = wx.TextCtrl(self, wx.ID_ANY, "0")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_jog_distance,
                  self.spin_jog_mils)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_jog_distance,
                  self.spin_jog_mils)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_jog_distance,
                  self.spin_jog_mm)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_jog_distance,
                  self.spin_jog_mm)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_jog_distance,
                  self.spin_jog_cm)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_jog_distance,
                  self.spin_jog_cm)
        self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_jog_distance,
                  self.spin_jog_inch)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_jog_distance,
                  self.spin_jog_inch)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_home,
                  self.button_navigate_home)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_ul,
                  self.button_navigate_up_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_u,
                  self.button_navigate_up)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_ur,
                  self.button_navigate_up_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_l,
                  self.button_navigate_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_r,
                  self.button_navigate_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_dl,
                  self.button_navigate_down_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_d,
                  self.button_navigate_down)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_dr,
                  self.button_navigate_down_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_unlock,
                  self.button_navigate_unlock)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_lock,
                  self.button_navigate_lock)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_corner_tl,
                  self.button_align_corner_top_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_drag_up,
                  self.button_align_drag_up)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_corner_tr,
                  self.button_align_corner_top_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_drag_left,
                  self.button_align_drag_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_center,
                  self.button_align_center)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_drag_right,
                  self.button_align_drag_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_corner_bl,
                  self.button_align_corner_bottom_left)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_drag_down,
                  self.button_align_drag_down)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_corner_br,
                  self.button_align_corner_bottom_right)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_first_position,
                  self.button_align_first_position)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_trace_hull,
                  self.button_align_trace_hull)
        self.Bind(wx.EVT_BUTTON, self.on_button_align_trace_quick,
                  self.button_align_trace_quick)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_pulse,
                  self.button_navigate_pulse)

        self.Bind(wx.EVT_BUTTON, self.on_scale_down, self.button_scale_down)
        self.Bind(wx.EVT_BUTTON, self.on_translate_up,
                  self.button_translate_up)
        self.Bind(wx.EVT_BUTTON, self.on_scale_up, self.button_scale_up)
        self.Bind(wx.EVT_BUTTON, self.on_translate_left,
                  self.button_translate_left)
        self.Bind(wx.EVT_BUTTON, self.on_reset, self.button_reset)
        self.Bind(wx.EVT_BUTTON, self.on_translate_right,
                  self.button_translate_right)
        self.Bind(wx.EVT_BUTTON, self.on_rotate_ccw, self.button_rotate_ccw)
        self.Bind(wx.EVT_BUTTON, self.on_translate_down,
                  self.button_translate_down)
        self.Bind(wx.EVT_BUTTON, self.on_rotate_cw, self.button_rotate_cw)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_a)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_c)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_e)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_b)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_d)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_matrix, self.text_f)

        self.Bind(wx.EVT_SPINCTRL, self.on_spin_pulse_duration,
                  self.spin_pulse_duration)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_pulse_duration,
                  self.spin_pulse_duration)
        self.Bind(wx.EVT_BUTTON, self.on_button_navigate_move_to,
                  self.button_navigate_move_to)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.elements = None
        self.console = None
        self.design_locked = False
        self.drag_ready(False)
        self.select_ready(False)

        # OSX Window close
        if parent is not None:
            parent.accelerator_table(self)
Ejemplo n.º 10
0
    def __init__(self, parent, operation, *args, **kwds):
        # begin wxGlade: OperationProperty.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((_simple_width, 500))

        self.main_panel = wx.Panel(self, wx.ID_ANY)
        self.button_add_layer = wx.BitmapButton(self.main_panel, wx.ID_ANY,
                                                icons8_plus_50.GetBitmap())
        self.listbox_layer = wx.ListBox(self.main_panel,
                                        wx.ID_ANY,
                                        choices=[],
                                        style=wx.LB_ALWAYS_SB | wx.LB_SINGLE)
        self.button_remove_layer = wx.BitmapButton(
            self.main_panel, wx.ID_ANY, icons8_delete_50.GetBitmap())
        self.button_layer_color = wx.Button(self.main_panel, wx.ID_ANY, "")
        self.combo_type = wx.ComboBox(
            self.main_panel,
            wx.ID_ANY,
            choices=[_("Engrave"),
                     _("Cut"), _("Raster"),
                     _("Image")],
            style=wx.CB_DROPDOWN)
        self.checkbox_output = wx.CheckBox(self.main_panel, wx.ID_ANY,
                                           _("Output"))
        self.checkbox_show = wx.CheckBox(self.main_panel, wx.ID_ANY, _("Show"))
        self.text_speed = wx.TextCtrl(self.main_panel, wx.ID_ANY, "20.0")
        self.text_power = wx.TextCtrl(self.main_panel, wx.ID_ANY, "1000.0")
        self.raster_panel = wx.Panel(self.main_panel, wx.ID_ANY)
        self.text_raster_step = wx.TextCtrl(self.raster_panel, wx.ID_ANY, "1")
        self.text_overscan = wx.TextCtrl(self.raster_panel, wx.ID_ANY, "20")
        self.combo_raster_direction = wx.ComboBox(self.raster_panel,
                                                  wx.ID_ANY,
                                                  choices=[
                                                      _("Top To Bottom"),
                                                      _("Bottom To Top"),
                                                      _("Right To Left"),
                                                      _("Left To Right"),
                                                      _("Crosshatch")
                                                  ],
                                                  style=wx.CB_DROPDOWN)
        self.radio_directional_raster = wx.RadioBox(
            self.raster_panel,
            wx.ID_ANY,
            _("Directional Raster"),
            choices=[_("Bidirectional"),
                     _("Unidirectional")],
            majorDimension=1,
            style=wx.RA_SPECIFY_ROWS)
        self.slider_top = wx.Slider(self.raster_panel, wx.ID_ANY, 1, 0, 2)
        self.slider_left = wx.Slider(self.raster_panel,
                                     wx.ID_ANY,
                                     1,
                                     0,
                                     2,
                                     style=wx.SL_VERTICAL)
        self.display_panel = wx.Panel(self.raster_panel, wx.ID_ANY)
        self.slider_right = wx.Slider(self.raster_panel,
                                      wx.ID_ANY,
                                      1,
                                      0,
                                      2,
                                      style=wx.SL_VERTICAL)
        self.slider_bottom = wx.Slider(self.raster_panel, wx.ID_ANY, 1, 0, 2)
        self.checkbox_advanced = wx.CheckBox(self.main_panel, wx.ID_ANY,
                                             _("Advanced"))
        self.advanced_panel = wx.Panel(self.main_panel, wx.ID_ANY)
        self.check_dratio_custom = wx.CheckBox(self.advanced_panel, wx.ID_ANY,
                                               _("Custom D-Ratio"))
        self.text_dratio = wx.TextCtrl(self.advanced_panel, wx.ID_ANY, "0.261")
        self.checkbox_custom_accel = wx.CheckBox(self.advanced_panel,
                                                 wx.ID_ANY, _("Acceleration"))
        self.slider_accel = wx.Slider(self.advanced_panel,
                                      wx.ID_ANY,
                                      1,
                                      1,
                                      4,
                                      style=wx.SL_AUTOTICKS | wx.SL_LABELS)
        self.check_dot_length_custom = wx.CheckBox(self.advanced_panel,
                                                   wx.ID_ANY,
                                                   _("Dot Length (mils)"))
        self.text_dot_length = wx.TextCtrl(self.advanced_panel, wx.ID_ANY, "1")
        self.check_group_pulse = wx.CheckBox(self.advanced_panel, wx.ID_ANY,
                                             _("Group Pulses"))
        self.check_passes = wx.CheckBox(self.advanced_panel, wx.ID_ANY,
                                        _("Passes"))
        self.text_passes = wx.TextCtrl(self.advanced_panel, wx.ID_ANY, "1")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.combo_type.SetFocus()
        self.operation = operation

        self.raster_pen = wx.Pen()
        self.raster_pen.SetColour(wx.BLACK)
        self.raster_pen.SetWidth(2)

        self.travel_pen = wx.Pen()
        self.travel_pen.SetColour(wx.Colour(255, 127, 255, 64))
        self.travel_pen.SetWidth(1)

        self.raster_lines = None
        self.travel_lines = None
Ejemplo n.º 11
0
    def __init__(self, parent, ops, *args, **kwds):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((659, 612))
        self.operations_listbox = wx.ListBox(self,
                                             wx.ID_ANY,
                                             choices=[],
                                             style=wx.LB_ALWAYS_SB
                                             | wx.LB_SINGLE)
        self.commands_listbox = wx.ListBox(self,
                                           wx.ID_ANY,
                                           choices=[],
                                           style=wx.LB_ALWAYS_SB
                                           | wx.LB_SINGLE)
        self.button_job_spooler = wx.BitmapButton(self, wx.ID_ANY,
                                                  icons8_route_50.GetBitmap())
        self.button_writer_control = wx.Button(self, wx.ID_ANY, _("Start Job"))
        self.button_writer_control.SetBitmap(icons8_laser_beam_52.GetBitmap())
        self.button_writer_control.SetFont(
            wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL, 0, "Segoe UI"))

        # Menu Bar
        self.JobInfo_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.menu_prehome = wxglade_tmp_menu.Append(wx.ID_ANY,
                                                    _("Home Before"), "",
                                                    wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_home_before,
                  id=self.menu_prehome.GetId())
        self.menu_autohome = wxglade_tmp_menu.Append(wx.ID_ANY,
                                                     _("Home After"), "",
                                                     wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_home_after,
                  id=self.menu_autohome.GetId())

        self.menu_prephysicalhome = wxglade_tmp_menu.Append(
            wx.ID_ANY, _("Physical Home Before"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_physicalhome_before,
                  id=self.menu_prephysicalhome.GetId())
        self.menu_autophysicalhome = wxglade_tmp_menu.Append(
            wx.ID_ANY, _("Physical Home After"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_physicalhome_after,
                  id=self.menu_autophysicalhome.GetId())

        self.menu_autoorigin = wxglade_tmp_menu.Append(
            wx.ID_ANY, _("Return to Origin After"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_origin_after,
                  id=self.menu_autoorigin.GetId())

        self.menu_autobeep = wxglade_tmp_menu.Append(wx.ID_ANY,
                                                     _("Beep After"), "",
                                                     wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.on_check_beep_after,
                  id=self.menu_autobeep.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Automatic"))

        wxglade_tmp_menu = wx.Menu()
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_home, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Physical Home"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_physicalhome, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Wait"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_wait, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Beep"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_beep, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Interrupt"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_interrupt, id=t.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Add"))

        wxglade_tmp_menu = wx.Menu()
        self.menu_rapid = wxglade_tmp_menu.Append(wx.ID_ANY,
                                                  _("Rapid Between"), "",
                                                  wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.on_check_rapid, id=self.menu_rapid.GetId())
        wxglade_tmp_menu.AppendSeparator()
        self.menu_jog = wxglade_tmp_menu.Append(wx.ID_ANY, _("Jog Standard"),
                                                "", wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.on_check_jog, id=self.menu_jog.GetId())
        # self.menu_jog2 = wxglade_tmp_menu.Append(wx.ID_ANY, _("Jog Switch"), "", wx.ITEM_RADIO)
        # self.Bind(wx.EVT_MENU, self.on_check_jog2, id=self.menu_jog2.GetId())
        self.menu_jog3 = wxglade_tmp_menu.Append(wx.ID_ANY, _("Jog Finish"),
                                                 "", wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.on_check_jog3, id=self.menu_jog3.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Settings"))

        wxglade_tmp_menu = wx.Menu()
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Step and Repeat"))
        self.Bind(wx.EVT_MENU, self.jobchange_step_repeat, id=t.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Tools"))

        self.SetMenuBar(self.JobInfo_menubar)
        # Menu Bar end

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LISTBOX, self.on_listbox_operation_click,
                  self.operations_listbox)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_operation_dclick,
                  self.operations_listbox)
        self.Bind(wx.EVT_LISTBOX, self.on_listbox_commands_click,
                  self.commands_listbox)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_commands_dclick,
                  self.commands_listbox)
        self.Bind(wx.EVT_BUTTON, self.on_button_start_job,
                  self.button_writer_control)
        self.Bind(wx.EVT_BUTTON, self.on_button_job_spooler,
                  self.button_job_spooler)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        # Moved to elements in 0.7.0
        self.preprocessor = OperationPreprocessor()
        if not isinstance(ops, list):
            ops = [ops]
        self.operations = ops
        self._original_ops = list(ops)
Ejemplo n.º 12
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Settings.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((455, 183))
        self.radio_units = wx.RadioBox(self,
                                       wx.ID_ANY,
                                       _("Units"),
                                       choices=["mm", "cm", "inch", "mils"],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_ROWS)
        self.combo_svg_ppi = wx.ComboBox(self,
                                         wx.ID_ANY,
                                         choices=[
                                             _("96 px/in Inkscape"),
                                             _("72 px/in Illustrator"),
                                             _("90 px/in Old Inkscape"),
                                             _("Custom")
                                         ],
                                         style=wx.CB_DROPDOWN)
        # self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "")
        self.checklist_options = wx.CheckListBox(
            self,
            wx.ID_ANY,
            choices=[
                _("Invert Mouse Wheel Zoom"),
                _("Print Shutdown"),
                _("SVG Uniform Save"),
                _("Image DPI Scaling"),
                _("Show Negative Guide"),
                _("Launch Spooler JobStart")
            ])
        from wxMeerK40t import supported_languages
        choices = [
            language_name for language_code, language_name, language_index in
            supported_languages
        ]
        self.combo_language = wx.ComboBox(self,
                                          wx.ID_ANY,
                                          choices=choices,
                                          style=wx.CB_DROPDOWN)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_TEXT, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_settings,
                  self.checklist_options)

        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
Ejemplo n.º 13
0
    def __init__(self, parent, *args, **kwds):
        # begin wxGlade: Settings.__init__
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "",
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)
        Module.__init__(self)
        self.SetSize((490, 280))
        self.radio_units = wx.RadioBox(self,
                                       wx.ID_ANY,
                                       _("Units"),
                                       choices=["mm", "cm", "inch", "mils"],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_ROWS)
        self.combo_svg_ppi = wx.ComboBox(self,
                                         wx.ID_ANY,
                                         choices=[
                                             _("96 px/in Inkscape"),
                                             _("72 px/in Illustrator"),
                                             _("90 px/in Old Inkscape"),
                                             _("Custom")
                                         ],
                                         style=wx.CB_DROPDOWN)
        # self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.text_svg_ppi = wx.TextCtrl(self, wx.ID_ANY, "")
        self.choices = [
            (_("Print Shutdown"), "print_shutdown", False),
            (_("SVG Uniform Save"), "uniform_svg", False),
            (_("Image DPI Scaling"), 'image_dpi', True),
            (_("DXF Centering"), 'dxf_center', True),
            (_("Show Negative Guide"), "show_negative_guide", True),
            (_("Launch Spooler JobStart"), "auto_spooler", True),
            (_("MouseWheel Pan"), "mouse_wheel_pan", False),
            (_("Invert MouseWheel Pan"), 'mouse_pan_invert', False),
            (_("Invert MouseWheel Zoom"), 'mouse_zoom_invert', False),
            (_("Default Operations"), "default_operations", False),
        ]
        self.checklist_options = wx.CheckListBox(
            self, wx.ID_ANY, choices=[c[0] for c in self.choices])

        from wxMeerK40t import supported_languages
        choices = [
            language_name for language_code, language_name, language_index in
            supported_languages
        ]
        self.combo_language = wx.ComboBox(self,
                                          wx.ID_ANY,
                                          choices=choices,
                                          style=wx.CB_DROPDOWN)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_svg_ppi, self.combo_svg_ppi)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_TEXT, self.on_text_svg_ppi, self.text_svg_ppi)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_settings,
                  self.checklist_options)

        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        # OSX Window close
        if parent is not None:
            parent.accelerator_table(self)