-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
878 additions
and
878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.