Commit 1ce9f3a5 authored by Keegi's avatar Keegi

workaround for buttons appearing in empty custom button slots on linux

attempt to fix panel context menu not appearing on empty slot
parent 44a2daa2
...@@ -657,12 +657,16 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -657,12 +657,16 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if 0.3*rr+0.59*gg+0.11*bb < 60: if 0.3*rr+0.59*gg+0.11*bb < 60:
b.SetForegroundColour("#ffffff") b.SetForegroundColour("#ffffff")
except: except:
b=wx.Button(self.panel,-1,"") b=wx.StaticText(self.panel,-1,"",size=(72,20),style=wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE) #+wx.SIMPLE_BORDER
b.Freeze() #b.Freeze()
b.Disable()
b.custombutton=i b.custombutton=i
b.properties=btndef b.properties=btndef
if btndef is not None:
b.Bind(wx.EVT_BUTTON,self.procbutton) b.Bind(wx.EVT_BUTTON,self.procbutton)
b.Bind(wx.EVT_MOUSE_EVENTS,self.editbutton) b.Bind(wx.EVT_MOUSE_EVENTS,self.editbutton)
else:
b.Bind(wx.EVT_BUTTON,lambda e:e.Skip())
self.custombuttonbuttons.append(b) self.custombuttonbuttons.append(b)
if i<4: if i<4:
ubs.Add(b) ubs.Add(b)
...@@ -817,18 +821,24 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -817,18 +821,24 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if hasattr(obj,"custombutton"): if hasattr(obj,"custombutton"):
self.dragging = wx.Button(self.panel,-1,obj.GetLabel()) self.dragging = wx.Button(self.panel,-1,obj.GetLabel())
self.dragging.SetBackgroundColour(obj.GetBackgroundColour()) self.dragging.SetBackgroundColour(obj.GetBackgroundColour())
self.dragging.SetForegroundColour(obj.GetForegroundColour())
self.dragging.sourcebutton = obj self.dragging.sourcebutton = obj
self.dragging.Raise() self.dragging.Raise()
self.dragging.Disable() self.dragging.Disable()
self.dragging.SetPosition(self.panel.ScreenToClient(scrpos)) self.dragging.SetPosition(self.panel.ScreenToClient(scrpos))
for b in self.custombuttonbuttons: for b in self.custombuttonbuttons:
if b.IsFrozen(): b.Thaw() #if b.IsFrozen(): b.Thaw()
if b.properties is None:
b.Enable()
# b.SetStyle(wx.ALIGN_CENTRE+wx.ST_NO_AUTORESIZE+wx.SIMPLE_BORDER)
self.last_drag_dest = obj self.last_drag_dest = obj
self.dragging.label = obj.s_label = obj.GetLabel() self.dragging.label = obj.s_label = obj.GetLabel()
self.dragging.bgc = obj.s_bgc = obj.GetBackgroundColour() self.dragging.bgc = obj.s_bgc = obj.GetBackgroundColour()
self.dragging.fgc = obj.s_fgc = obj.GetForegroundColour()
else: else:
# dragging in progress # dragging in progress
self.dragging.SetPosition(self.panel.ScreenToClient(scrpos)) self.dragging.SetPosition(self.panel.ScreenToClient(scrpos))
wx.CallAfter(self.dragging.Refresh)
btns = self.custombuttonbuttons btns = self.custombuttonbuttons
dst = None dst = None
src = self.dragging.sourcebutton src = self.dragging.sourcebutton
...@@ -856,16 +866,21 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -856,16 +866,21 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if dst is not self.last_drag_dest: if dst is not self.last_drag_dest:
if self.last_drag_dest is not None: if self.last_drag_dest is not None:
self.last_drag_dest.SetBackgroundColour(self.last_drag_dest.s_bgc) self.last_drag_dest.SetBackgroundColour(self.last_drag_dest.s_bgc)
self.last_drag_dest.SetForegroundColour(self.last_drag_dest.s_fgc)
self.last_drag_dest.SetLabel(self.last_drag_dest.s_label) self.last_drag_dest.SetLabel(self.last_drag_dest.s_label)
if dst is not None and dst is not src: if dst is not None and dst is not src:
dst.s_bgc = dst.GetBackgroundColour() dst.s_bgc = dst.GetBackgroundColour()
dst.s_fgc = dst.GetForegroundColour()
dst.s_label = dst.GetLabel() dst.s_label = dst.GetLabel()
src.SetBackgroundColour(dst.GetBackgroundColour()) src.SetBackgroundColour(dst.GetBackgroundColour())
src.SetForegroundColour(dst.GetForegroundColour())
src.SetLabel(dst.GetLabel()) src.SetLabel(dst.GetLabel())
dst.SetBackgroundColour(drg.bgc) dst.SetBackgroundColour(drg.bgc)
dst.SetForegroundColour(drg.fgc)
dst.SetLabel(drg.label) dst.SetLabel(drg.label)
else: else:
src.SetBackgroundColour(drg.bgc) src.SetBackgroundColour(drg.bgc)
src.SetForegroundColour(drg.fgc)
src.SetLabel(drg.label) src.SetLabel(drg.label)
self.last_drag_dest = dst self.last_drag_dest = dst
elif hasattr(self,"dragging") and not e.ButtonIsDown(wx.MOUSE_BTN_LEFT): elif hasattr(self,"dragging") and not e.ButtonIsDown(wx.MOUSE_BTN_LEFT):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment