Пример #1
0
    def __init__(self, canvas: "EditCanvas"):
        wx.BoxSizer.__init__(self, wx.VERTICAL)
        BaseToolUI.__init__(self, canvas)
        self._active_operation: Optional[OperationUIType] = None

        horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self._operation_choice = SimpleChoiceAny(self.canvas)
        self._reload_operation = wx.BitmapButton(
            self.canvas, bitmap=REFRESH_ICON.bitmap(16, 16)
        )
        self._reload_operation.SetToolTip("Reload selected operation")

        horizontal_sizer.Add(self._operation_choice)
        horizontal_sizer.Add(self._reload_operation)

        self.Add(horizontal_sizer)

        self._operation_choice.SetItems(
            {key: value.name for key, value in self._operations.items()}
        )
        self._operation_choice.Bind(wx.EVT_CHOICE, self._on_operation_change)

        self._reload_operation.Bind(wx.EVT_BUTTON, self._reload_operation_loader)

        self._operation_sizer = wx.BoxSizer(wx.VERTICAL)
        self.Add(self._operation_sizer, 1, wx.EXPAND)
Пример #2
0
    def __init__(self, canvas: "EditCanvas"):
        wx.BoxSizer.__init__(self, wx.VERTICAL)
        BaseToolUI.__init__(self, canvas)
        self._active_operation: Optional[OperationUIType] = None

        self._operation_choice = SimpleChoiceAny(self.canvas)
        self._operation_choice.SetItems({key: value.name for key, value in self._operations.items()})
        self._operation_choice.Bind(wx.EVT_CHOICE, self._on_operation_change)
        self.Add(self._operation_choice)
        self._operation_sizer = wx.BoxSizer(wx.VERTICAL)
        self.Add(self._operation_sizer)
Пример #3
0
    def __init__(self, canvas: 'EditCanvas'):
        wx.BoxSizer.__init__(self, wx.HORIZONTAL)
        BaseToolUI.__init__(self, canvas)

        self._button_panel = wx.Panel(canvas)
        button_sizer = wx.BoxSizer(wx.VERTICAL)
        self._button_panel.SetSizer(button_sizer)
        delete_button = wx.Button(self._button_panel, label="Delete")
        button_sizer.Add(delete_button, 0,
                         wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)
        delete_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.delete())
        copy_button = wx.Button(self._button_panel, label="Copy")
        button_sizer.Add(copy_button, 0,
                         wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)
        copy_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.copy())
        cut_button = wx.Button(self._button_panel, label="Cut")
        button_sizer.Add(cut_button, 0,
                         wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)
        cut_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.cut())
        paste_button = wx.Button(self._button_panel, label="Paste")
        button_sizer.Add(paste_button, 0,
                         wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 5)
        paste_button.Bind(wx.EVT_BUTTON, lambda evt: self.canvas.paste())
        self.Add(self._button_panel, 0, wx.ALIGN_CENTER_VERTICAL)

        self._paste_panel: Optional[SelectLocationUI] = None

        self._x1: wx.SpinCtrl = self._add_row('x1',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._y1: wx.SpinCtrl = self._add_row('y1',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._z1: wx.SpinCtrl = self._add_row('z1',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._x1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._y1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._z1.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._x1.SetValidator(IntValidator())
        self._y1.SetValidator(IntValidator())
        self._z1.SetValidator(IntValidator())

        self._x2: wx.SpinCtrl = self._add_row('x2',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._y2: wx.SpinCtrl = self._add_row('y2',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._z2: wx.SpinCtrl = self._add_row('z2',
                                              wx.SpinCtrl,
                                              min=-30000000,
                                              max=30000000)
        self._x2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._y2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._z2.Bind(wx.EVT_SPINCTRL, self._box_input_change)
        self._x2.SetValidator(IntValidator())
        self._y2.SetValidator(IntValidator())
        self._z2.SetValidator(IntValidator())

        self._x1.Disable()
        self._y1.Disable()
        self._z1.Disable()
        self._x2.Disable()
        self._y2.Disable()
        self._z2.Disable()

        self._x1.SetBackgroundColour((160, 215, 145))
        self._y1.SetBackgroundColour((160, 215, 145))
        self._z1.SetBackgroundColour((160, 215, 145))

        self._x2.SetBackgroundColour((150, 150, 215))
        self._y2.SetBackgroundColour((150, 150, 215))
        self._z2.SetBackgroundColour((150, 150, 215))