def init_pallete(self): groups = device_data.get_groups() for name, expbmap, colbmap in groups: self.add_group(name, expbmap, colbmap) devices = device_data.get_devices() for name, group in devices: bmap = device_data.get_device_bmap(name) sel_bmap = device_data.get_device_bmap(name, True) self.add_item_bmap(group, name, bmap, sel_bmap)
def on_mouse_motion(self, event): if (self.drag_loc < 0 or not event.Dragging() or not event.LeftIsDown()): return pt = event.GetPosition() if (not self.drag_image): # BED zooming support check_pt = wx.Point(pt.x / self.zoom, pt.y / self.zoom) tolerance = 4 dx = abs(check_pt.x - self.drag_start_pos.x) dy = abs(check_pt.y - self.drag_start_pos.y) if (dx <= tolerance and dy <= tolerance): return # remove the old one but remember it if we have to put it back self.drag_start = (self.drag_loc, self.drag_name) win_data.config_move_start(self.drag_loc) # force the work area to redraw self.Refresh() self.Update() win_data.force_redraw('config') # get the selected variant since we had to click to get here bmp = device_data.get_device_bmap(self.drag_name, True) if (self.zoom != 1.0): image = bmp.ConvertToImage() w = image.GetWidth() * self.zoom h = image.GetHeight() * self.zoom image.Rescale(w, h) bmp = image.ConvertToBitmap() self.drag_image = wx.DragImage(bmp, wx.StockCursor(wx.CURSOR_HAND)) #dev_x,dev_y = device_data.get_device_size() dev_x, dev_y = bmp.GetSize() hotspot = (dev_x / 2, dev_y / 2) #print "on_mouse_motion: hotspot", hotspot self.drag_image.BeginDrag(hotspot, self, False, self.GetClientRect()) loc, update, dummy = self.local_move_centre_pt( pt, self.drag_name, self.drag_image) self.drag_image.Move(pt) self.drag_image.Show() else: loc, update, dummy = self.local_move_centre_pt( pt, self.drag_name, self.drag_image) self.drag_image.Move(pt) if (update): self.drag_image.Show()
def on_mouse_motion(self, event): if (self.drag_loc < 0 or not event.Dragging() or not event.LeftIsDown()): return pt = event.GetPosition() if (not self.drag_image): # BED zooming support check_pt = wx.Point(pt.x/self.zoom, pt.y/self.zoom) tolerance = 4 dx = abs(check_pt.x - self.drag_start_pos.x) dy = abs(check_pt.y - self.drag_start_pos.y) if (dx <= tolerance and dy <= tolerance): return # remove the old one but remember it if we have to put it back self.drag_start = (self.drag_loc, self.drag_name) win_data.config_move_start(self.drag_loc) # force the work area to redraw self.Refresh() self.Update() win_data.force_redraw('config') # get the selected variant since we had to click to get here bmp = device_data.get_device_bmap(self.drag_name, True) if (self.zoom != 1.0): image = bmp.ConvertToImage() w = image.GetWidth() * self.zoom h = image.GetHeight() * self.zoom image.Rescale(w, h) bmp = image.ConvertToBitmap() self.drag_image = wx.DragImage(bmp, wx.StockCursor(wx.CURSOR_HAND)) #dev_x,dev_y = device_data.get_device_size() dev_x,dev_y = bmp.GetSize() hotspot = (dev_x/2, dev_y/2) #print "on_mouse_motion: hotspot", hotspot self.drag_image.BeginDrag(hotspot, self, False, self.GetClientRect()) loc,update,dummy = self.local_move_centre_pt(pt, self.drag_name, self.drag_image) self.drag_image.Move(pt) self.drag_image.Show() else: loc,update,dummy = self.local_move_centre_pt(pt, self.drag_name, self.drag_image) self.drag_image.Move(pt) if (update): self.drag_image.Show()