mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-04 14:56:38 +00:00
f504fa2b76
1) Add background colour toolbar beneath (foreground) colour toolbar. 2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}. 3) Add {de,in}crease {brush,canvas} size accelerator. 4) Add {hide,show} assets window toolbar item. 5) Circle tool: draw outline with foreground colour. 6) Circle tool: honour transparency. 7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>. 8) Fill tool: fill with {back,fore}ground colour given <[RL]MB> 9) Fix arrow keys cursor motion when scrolled down. 10 Instantly reflect {brush size,colour,tool} changes in canvas. 11) Object tool: honour transparency w/ non-external objects. 12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>. 13) Rectangle tool: draw outline with foreground colour. 14) Rectangle tool: honour transparency. 15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt(). 16) Restore scrolling position after resizing canvas. .TODO: deleted. assets/audio/roar{arab8,spoke11}.wav: added. assets/text/hotkeys.txt: added to document hotkeys. assets/text/requirements.txt, requirements.txt: moved. assets/text/TODO: updated. {assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers. libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message. libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
66 lines
2.4 KiB
Python
66 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# GuiWindow.py
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
#
|
|
|
|
import wx
|
|
|
|
class GuiWindow(wx.ScrolledWindow):
|
|
def _updateScrollBars(self):
|
|
if self.size != None:
|
|
clientSize = self.GetClientSize()
|
|
if (self.size[0] > clientSize[0]) or (self.size[1] > clientSize[1]):
|
|
self.scrollFlag = True; super().SetVirtualSize(self.size);
|
|
elif self.scrollFlag \
|
|
and ((self.size[0] <= clientSize[0]) or (self.size[1] <= clientSize[1])):
|
|
self.scrollFlag = False; super().SetVirtualSize((0, 0));
|
|
|
|
|
|
def onClose(self, event):
|
|
self.Destroy()
|
|
|
|
def onEnterWindow(self, event):
|
|
event.Skip()
|
|
|
|
def onKeyboardInput(self, event):
|
|
return False
|
|
|
|
def onLeaveWindow(self, event):
|
|
event.Skip()
|
|
|
|
def onMouseInput(self, event):
|
|
return False
|
|
|
|
def onPaint(self, event):
|
|
event.Skip()
|
|
|
|
def onScroll(self, event):
|
|
event.Skip()
|
|
|
|
def onSize(self, event):
|
|
self._updateScrollBars(); event.Skip();
|
|
|
|
def resize(self, newSize):
|
|
self.size = newSize; self._updateScrollBars();
|
|
self.SetMinSize(self.size); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.size);
|
|
curWindow = self
|
|
while curWindow != None:
|
|
curWindow.Layout(); curWindow = curWindow.GetParent();
|
|
|
|
|
|
#
|
|
# __init__(self, parent, pos, scrollStep, style=0): initialisation method
|
|
def __init__(self, parent, pos, scrollStep, style=0):
|
|
super().__init__(parent, pos=pos, style=style) if style != 0 else super().__init__(parent, pos=pos)
|
|
self.pos, self.scrollFlag, self.scrollStep, self.size = pos, False, scrollStep, None
|
|
for eventType, f in (
|
|
(wx.EVT_CHAR, self.onKeyboardInput), (wx.EVT_CLOSE, self.onClose), (wx.EVT_ENTER_WINDOW, self.onEnterWindow),
|
|
(wx.EVT_LEAVE_WINDOW, self.onLeaveWindow), (wx.EVT_LEFT_DOWN, self.onMouseInput), (wx.EVT_MOTION, self.onMouseInput),
|
|
(wx.EVT_PAINT, self.onPaint), (wx.EVT_RIGHT_DOWN, self.onMouseInput), (wx.EVT_SCROLLWIN_LINEDOWN, self.onScroll),
|
|
(wx.EVT_SCROLLWIN_LINEUP, self.onScroll), (wx.EVT_SIZE, self.onSize)):
|
|
self.Bind(eventType, f)
|
|
self.SetScrollRate(*self.scrollStep); self._updateScrollBars();
|
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|