Skip to content

Commit

Permalink
rename file
Browse files Browse the repository at this point in the history
  • Loading branch information
nachifur committed Jul 20, 2021
1 parent ffb0a0c commit 0a5a497
Show file tree
Hide file tree
Showing 8 changed files with 878 additions and 878 deletions.
85 changes: 85 additions & 0 deletions MulimgViewer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import wx
from main import MulimgViewer
from path_select import PathSelectFrame
import wx.lib.inspection


class GuiManager():
def __init__(self, UpdateUI, get_type):
self.UpdateUI = UpdateUI
self.get_type = get_type
self.frameDict = {}

def GetFrame(self, type):
frame = self.frameDict.get(type)

if frame is None:
frame = self.CreateFrame(type)
self.frameDict[type] = frame

return frame

def CreateFrame(self, type):
if type == 0:
return MulimgViewer(None, self.UpdateUI, self.get_type)
elif type == 1:
return PathSelectFrame(None, self.UpdateUI, self.get_type)


class MainAPP(wx.App):

def OnInit(self):
self.manager = GuiManager(self.UpdateUI, self.get_type)
self.frame = []
self.frame.append(self.manager.GetFrame(0))
self.frame.append(self.manager.GetFrame(1))
self.frame[0].Show()
self.SetTopWindow(self.frame[0])
self.type = 0 # init show MulimgViewer
return True

def UpdateUI(self, type, input_path=None):
# type=1: PathSelectFrame
# type=0: MulimgViewer
# type=-1: Close
self.type = type

if input_path != None:
if len(input_path) != 0:
# refresh one_dir_mul_dir_manual path
self.frame[0].ImgManager.init(
input_path, 1)
self.frame[1].refresh_txt(input_path)

self.frame[0].show_img_init()
self.frame[0].ImgManager.set_action_count(0)
self.frame[0].show_img()


if type == -1:
# close window
self.frame[0].close(None)
self.frame[1].close(None)
elif type == 0:
# hidden PathSelectFrame, show MulimgViewer
self.frame[1].Show(False)
self.frame[type].Show(True)
elif type == 1:
# show PathSelectFrame
self.frame[type].Show(True)

return True

def get_type(self):
return self.type


def main():
app = MainAPP()
# debug
# wx.lib.inspection.InspectionTool().Show()
app.MainLoop()


if __name__ == '__main__':
main()
Loading

0 comments on commit 0a5a497

Please sign in to comment.