mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-21 14:56:37 +00:00
Load & store LRU file dialogue directory.
assets/text/TODO: updated.
This commit is contained in:
parent
c7dd80327d
commit
35f6910427
@ -18,13 +18,11 @@
|
||||
Release roadmap:
|
||||
1) BUG: fix & finish Arabic/RTL text tool support
|
||||
2) BUG: a) text tool b) paste text c) undo
|
||||
3) BUG: a) tile once b) tile twice
|
||||
4) {copy,cut,delete,insert from,paste}, edit asset in new canvas, import from {canvas,object}
|
||||
5) add hotkeys.txt mIRC art canvas to help menu
|
||||
6) {load,store} LRU {open,save} directory
|
||||
7) operators: crop, scale, shift, slice
|
||||
8) auto{load,save} & {backup,restore}
|
||||
9) tools: unicode block elements
|
||||
10) floating/dockable toolbar
|
||||
3) {copy,cut,delete,insert from,paste}, edit asset in new canvas, import from {canvas,object}
|
||||
4) add hotkeys.txt mIRC art canvas to help menu
|
||||
5) operators: crop, scale, shift, slice
|
||||
6) auto{load,save} & {backup,restore}
|
||||
7) tools: unicode block elements
|
||||
8) floating/dockable toolbar
|
||||
|
||||
vim:ff=dos tw=0
|
||||
|
@ -7,6 +7,7 @@
|
||||
from Canvas import Canvas
|
||||
from GuiFrame import GuiMiniFrame
|
||||
from GuiWindow import GuiWindow
|
||||
from RtlPlatform import getLocalConfPathName
|
||||
import json, os, sys, wx
|
||||
|
||||
class RoarAssetsWindow(GuiMiniFrame):
|
||||
@ -37,7 +38,9 @@ class RoarAssetsWindow(GuiMiniFrame):
|
||||
else:
|
||||
for pathName in dialog.GetPaths():
|
||||
resultList += [self._import(f, pathName)]
|
||||
self.lastDir = os.path.dirname(pathName)
|
||||
lastDir = os.path.dirname(pathName)
|
||||
if self.lastDir != lastDir:
|
||||
self.lastDir = lastDir; self._storeLastDir(self.lastDir);
|
||||
return resultList
|
||||
|
||||
def _load_list(self, pathName):
|
||||
@ -81,6 +84,17 @@ class RoarAssetsWindow(GuiMiniFrame):
|
||||
with wx.MessageDialog(self, "Error: {}".format(str(e)), "", wx.OK | wx.OK_DEFAULT) as dialog:
|
||||
dialogChoice = dialog.ShowModal()
|
||||
|
||||
def _loadLastDir(self):
|
||||
localConfFileName = getLocalConfPathName("RecentAssetsDir.txt")
|
||||
if os.path.exists(localConfFileName):
|
||||
with open(localConfFileName, "r", encoding="utf-8") as inFile:
|
||||
self.lastDir = inFile.read().rstrip("\r\n")
|
||||
|
||||
def _storeLastDir(self, pathName):
|
||||
localConfFileName = getLocalConfPathName("RecentAssetsDir.txt")
|
||||
with open(localConfFileName, "w", encoding="utf-8") as outFile:
|
||||
print(pathName, file=outFile)
|
||||
|
||||
def _updateScrollBars(self):
|
||||
clientSize = self.panelCanvas.GetClientSize()
|
||||
if self.currentIndex != None:
|
||||
@ -235,7 +249,8 @@ class RoarAssetsWindow(GuiMiniFrame):
|
||||
if self.lastDir != None:
|
||||
dialog.SetDirectory(self.lastDir)
|
||||
if dialog.ShowModal() != wx.ID_CANCEL:
|
||||
pathName = dialog.GetPath(); self.lastDir = os.path.dirname(pathName);
|
||||
pathName = dialog.GetPath()
|
||||
self.lastDir = os.path.dirname(pathName); self._storeLastDir(self.lastDir);
|
||||
self._load_list(pathName)
|
||||
|
||||
def onRemove(self, event):
|
||||
@ -264,7 +279,8 @@ class RoarAssetsWindow(GuiMiniFrame):
|
||||
if self.lastDir != None:
|
||||
dialog.SetDirectory(self.lastDir)
|
||||
if dialog.ShowModal() != wx.ID_CANCEL:
|
||||
pathName = dialog.GetPath(); self.lastDir = os.path.dirname(pathName);
|
||||
pathName = dialog.GetPath()
|
||||
self.lastDir = os.path.dirname(pathName); self._storeLastDir(self.lastDir);
|
||||
with open(pathName, "w") as fileObject:
|
||||
for pathName in [self.canvasList[k][1] for k in self.canvasList.keys()]:
|
||||
print(pathName, file=fileObject)
|
||||
@ -284,6 +300,7 @@ class RoarAssetsWindow(GuiMiniFrame):
|
||||
self.backend, self.canvasList, self.lastDir = backend((0, 0), cellSize), {}, None
|
||||
self.cellSize, self.currentIndex, self.leftDown, self.parent, self.scrollFlag = cellSize, None, False, parent, False
|
||||
self.Bind(wx.EVT_CHAR, self.onChar)
|
||||
self._loadLastDir()
|
||||
|
||||
self.contextMenu, self.contextMenuItems = wx.Menu(), []
|
||||
for text, f in (
|
||||
|
@ -48,9 +48,15 @@ class RoarCanvasCommandsFile():
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return False, None
|
||||
elif self._promptSaveChanges():
|
||||
pathName = dialog.GetPath(); self.lastDir = os.path.dirname(pathName);
|
||||
pathName = dialog.GetPath(); self.lastDir = os.path.dirname(pathName); self._storeLastDir(self.lastDir);
|
||||
return self._import(f, newDirty, pathName)
|
||||
|
||||
def _loadLastDir(self):
|
||||
localConfFileName = getLocalConfPathName("RecentDir.txt")
|
||||
if os.path.exists(localConfFileName):
|
||||
with open(localConfFileName, "r", encoding="utf-8") as inFile:
|
||||
self.lastDir = inFile.read().rstrip("\r\n")
|
||||
|
||||
def _loadRecent(self):
|
||||
localConfFileName = getLocalConfPathName("Recent.lst")
|
||||
if os.path.exists(localConfFileName):
|
||||
@ -91,6 +97,11 @@ class RoarCanvasCommandsFile():
|
||||
for lastFile in [l["pathName"] for l in self.lastFiles]:
|
||||
print(lastFile, file=outFile)
|
||||
|
||||
def _storeLastDir(self, pathName):
|
||||
localConfFileName = getLocalConfPathName("RecentDir.txt")
|
||||
with open(localConfFileName, "w", encoding="utf-8") as outFile:
|
||||
print(pathName, file=outFile)
|
||||
|
||||
@GuiCommandDecorator("Clear list", "&Clear list", None, None, False)
|
||||
def canvasClearRecent(self, event):
|
||||
if self.lastFiles != None:
|
||||
@ -115,7 +126,7 @@ class RoarCanvasCommandsFile():
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return False
|
||||
else:
|
||||
outPathName = dialog.GetPath(); self.lastDir = os.path.dirname(outPathName);
|
||||
outPathName = dialog.GetPath(); self.lastDir = os.path.dirname(outPathName); self._storeLastDir(self.lastDir);
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||
with open(outPathName, "w", encoding="utf-8") as outFile:
|
||||
self.parentCanvas.canvas.exportStore.exportAnsiFile(self.parentCanvas.canvas.map, self.parentCanvas.canvas.size, outFile)
|
||||
@ -130,7 +141,7 @@ class RoarCanvasCommandsFile():
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return False
|
||||
else:
|
||||
outPathName = dialog.GetPath(); self.lastDir = os.path.dirname(outPathName);
|
||||
outPathName = dialog.GetPath(); self.lastDir = os.path.dirname(outPathName); self._storeLastDir(self.lastDir);
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||
self.parentCanvas.canvas.exportStore.exportBitmapToPngFile(self.parentCanvas.backend.canvasBitmap, outPathName, wx.BITMAP_TYPE_PNG)
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||
@ -258,7 +269,7 @@ class RoarCanvasCommandsFile():
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return False
|
||||
else:
|
||||
self.canvasPathName = dialog.GetPath(); self.lastDir = os.path.dirname(self.canvasPathName);
|
||||
self.canvasPathName = dialog.GetPath(); self.lastDir = os.path.dirname(self.canvasPathName); self._storeLastDir(self.lastDir);
|
||||
if self.canvasSave(event, newDirty=True):
|
||||
self._pushRecent(self.canvasPathName)
|
||||
|
||||
|
2
roar.py
2
roar.py
@ -20,7 +20,7 @@ def main(*argv):
|
||||
os.makedirs(localConfirName)
|
||||
wxApp, roarClient = wx.App(False), RoarClient(None)
|
||||
argv0, argv = argv[0], argv[1:]
|
||||
roarClient.canvasPanel.commands._loadRecent()
|
||||
roarClient.canvasPanel.commands._loadLastDir(); roarClient.canvasPanel.commands._loadRecent();
|
||||
if len(argv) >= 1:
|
||||
if (len(argv) >= 2) and (argv[1].endswith(".lst")):
|
||||
roarClient.assetsWindow._load_list(argv[1])
|
||||
|
Loading…
Reference in New Issue
Block a user