From aea472437ea168c461fdd172c9326edbd4b0e3f6 Mon Sep 17 00:00:00 2001 From: Chinesehou97 <202169359@qq.com> Date: Sat, 24 Aug 2024 14:40:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BC=A0=E6=A0=87=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E6=B0=94=E6=B3=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20&=20=E5=A2=9E=E5=8A=A0=E5=8F=AF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=B9=B6=E5=8A=A0=E8=BD=BD=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8A=9F=E8=83=BDv2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- output.json | 1 + src/mulimgviewer/gui/main_gui.fbp | 176 +++++++++++++++++++++++++++--- src/mulimgviewer/gui/main_gui.py | 25 ++++- src/mulimgviewer/src/main.py | 116 +++++++++++++++++++- 4 files changed, 297 insertions(+), 21 deletions(-) create mode 100644 output.json diff --git a/output.json b/output.json new file mode 100644 index 0000000..3d6ce66 --- /dev/null +++ b/output.json @@ -0,0 +1 @@ +{"row_col": "1,2", "row_col_one_img": "1,1", "show_scale": "1,1", "row_col_img_unit": "3,1", "gap": "10,10,5,5,3,3,2,2", "magnifer_row_col": "1,1", "output_scale": "1,1", "img_resolution": "-1,-1", "magnifer_resolution": "-1,-1", "magnifier_show_scale": "-1,-1", "line_width": "2,2", "magnifier_out_scale": "1,1", "title_font_size": "20", "box_position": 0, "choice_normalized_size": 0, "choice_output": 4, "image_interp": 0, "Magnifier_format": 1, "title_font": 0, "parallel_sequential": false, "parallel_to_sequential": false, "auto_save_all": false, "move_file": false, "img_vertical": false, "one_img_vertical": false, "img_unit_vertical": false, "magnifer_vertical": true, "show_original": true, "show_magnifer": true, "title_show": true, "auto_layout_check": false, "one_img": false, "onetitle": false, "customfunc": false, "show_box": true, "show_box_in_crop": true, "select_img_box": false, "title_auto": false, "title_exif": false, "title_show_parent": false, "title_show_prefix": true, "title_show_name": true, "title_show_suffix": false, "title_down_up": false} \ No newline at end of file diff --git a/src/mulimgviewer/gui/main_gui.fbp b/src/mulimgviewer/gui/main_gui.fbp index 0d6c278..d8461b6 100644 --- a/src/mulimgviewer/gui/main_gui.fbp +++ b/src/mulimgviewer/gui/main_gui.fbp @@ -19,7 +19,7 @@ 1 UI mulimg_viewer - D:\ncfey\Desktop\github\MulimgViewer\src\mulimgviewer\gui + C:\Users\46225\Desktop\8.21\fork824\MulimgViewer\src\mulimgviewer\gui 0 source_name 1 @@ -73,11 +73,11 @@ none 2 0 - + 5 wxEXPAND | wxALL 1 - + 1 1 1 @@ -129,7 +129,7 @@ wxTAB_TRAVERSAL - + wxWRAPSIZER_DEFAULT_FLAGS -1,-1 wSizer1 @@ -1376,8 +1376,8 @@ split_sash_pos_changed split_sash_pos_changing - - + + 1 1 1 @@ -1431,7 +1431,7 @@ wxHSCROLL|wxVSCROLL - + 1 wxBOTH @@ -1756,6 +1756,154 @@ -1 + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Save + + 0 + + 0 + + + 0 + + 1 + m_toggleBtn4 + 1 + + + protected + 1 + + + + Resizable + 1 + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 1 + + + + save_configuration + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Load + + 0 + + 0 + + + 0 + + 1 + m_button7 + 1 + + + protected + 1 + -1,-1 + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + load_configuration + + 5 wxEXPAND | wxALL @@ -3725,7 +3873,7 @@ 1 0 - 0 + 1 1 1 @@ -5104,7 +5252,7 @@ none 5 - wxALL|wxALIGN_CENTER_VERTICAL + wxALL 0 1 @@ -5135,7 +5283,7 @@ 0 0 wxID_ANY - 🔍️Types + 🔍️Typed 0 0 @@ -5153,7 +5301,7 @@ Resizable 1 - -1,-1 + 100,-1 ; ; forward_declare 0 @@ -5166,7 +5314,7 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL + wxALL 0 1 @@ -5213,7 +5361,7 @@ 1 -1,-1 Resizable - 0 + 1 1 @@ -5439,7 +5587,7 @@ 1 0 - 1 + 0 1 1 diff --git a/src/mulimgviewer/gui/main_gui.py b/src/mulimgviewer/gui/main_gui.py index c9a0eda..e8aa113 100644 --- a/src/mulimgviewer/gui/main_gui.py +++ b/src/mulimgviewer/gui/main_gui.py @@ -148,6 +148,13 @@ def __init__( self, parent ): fgSizer3.Add( self.m_staticText38, 0, wx.ALL, 5 ) + self.m_toggleBtn4 = wx.ToggleButton( self.m_panel4, wx.ID_ANY, u"Save", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_toggleBtn4.SetValue( True ) + fgSizer3.Add( self.m_toggleBtn4, 0, wx.ALL, 5 ) + + self.m_button7 = wx.Button( self.m_panel4, wx.ID_ANY, u"Load", wx.Point( -1,-1 ), wx.DefaultSize, 0 ) + fgSizer3.Add( self.m_button7, 0, wx.ALL, 5 ) + self.m_staticline3 = wx.StaticLine( self.m_panel4, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 ) @@ -318,6 +325,7 @@ def __init__( self, parent ): bSizer101.Add( self.magnifer_row_col, 0, wx.ALL, 5 ) self.magnifer_vertical = wx.CheckBox( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.magnifer_vertical.SetValue(True) bSizer101.Add( self.magnifer_vertical, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -422,15 +430,15 @@ def __init__( self, parent ): wSizer111 = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) - self.m_staticText36 = wx.StaticText( self.m_panel4, wx.ID_ANY, u"🔍️Types", wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) + self.m_staticText36 = wx.StaticText( self.m_panel4, wx.ID_ANY, u"🔍️Typed", wx.DefaultPosition, wx.Size( 100,-1 ), 0 ) self.m_staticText36.Wrap( -1 ) - wSizer111.Add( self.m_staticText36, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) + wSizer111.Add( self.m_staticText36, 0, wx.ALL, 5 ) Magnifier_formatChoices = [ u"equal length width", u"equal width", u"equal height " ] self.Magnifier_format = wx.Choice( self.m_panel4, wx.ID_ANY, wx.Point( -1,-1 ), wx.DefaultSize, Magnifier_formatChoices, 0 ) - self.Magnifier_format.SetSelection( 0 ) - wSizer111.Add( self.Magnifier_format, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) + self.Magnifier_format.SetSelection( 1 ) + wSizer111.Add( self.Magnifier_format, 0, wx.ALL, 5 ) fgSizer3.Add( wSizer111, 1, wx.EXPAND, 5 ) @@ -451,7 +459,6 @@ def __init__( self, parent ): wSizer2.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 ) self.title_auto = wx.CheckBox( self.m_panel4, wx.ID_ANY, u"Auto", wx.DefaultPosition, wx.DefaultSize, 0 ) - self.title_auto.SetValue(True) wSizer2.Add( self.title_auto, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) self.title_exif = wx.CheckBox( self.m_panel4, wx.ID_ANY, u"EXIF", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -787,6 +794,8 @@ def __init__( self, parent ): self.flip.Bind( wx.EVT_TOGGLEBUTTON, self.flip_fc ) self.m_splitter1.Bind( wx.EVT_SPLITTER_SASH_POS_CHANGED, self.split_sash_pos_changed ) self.m_splitter1.Bind( wx.EVT_SPLITTER_SASH_POS_CHANGING, self.split_sash_pos_changing ) + self.m_toggleBtn4.Bind( wx.EVT_TOGGLEBUTTON, self.save_configuration ) + self.m_button7.Bind( wx.EVT_BUTTON, self.load_configuration ) self.choice_normalized_size.Bind( wx.EVT_CHOICE, self.change_img_stitch_mode ) self.parallel_sequential.Bind( wx.EVT_CHECKBOX, self.parallel_sequential_fc ) self.parallel_to_sequential.Bind( wx.EVT_CHECKBOX, self.parallel_to_sequential_fc ) @@ -863,6 +872,12 @@ def split_sash_pos_changed( self, event ): def split_sash_pos_changing( self, event ): event.Skip() + def save_configuration( self, event ): + event.Skip() + + def load_configuration( self, event ): + event.Skip() + def change_img_stitch_mode( self, event ): event.Skip() diff --git a/src/mulimgviewer/src/main.py b/src/mulimgviewer/src/main.py index 944a352..e9ef254 100644 --- a/src/mulimgviewer/src/main.py +++ b/src/mulimgviewer/src/main.py @@ -12,7 +12,7 @@ from .index_table import IndexTable from .utils import MyTestEvent, get_resource_path from .utils_img import ImgManager - +import json class MulimgViewer (MulimgViewerGui): @@ -65,7 +65,17 @@ def __init__(self, parent, UpdateUI, get_type, default_path=None): self.m_statusBar1.SetStatusWidths([-2, -1, -4, -4]) self.set_title_font() self.hidden_flag = 0 - + self.button_open_all.SetToolTip("open") + self.m_button6.SetToolTip("out path") + self.save_butoon.SetToolTip("save") + self.m_button3.SetToolTip("left arrow") + self.m_button4.SetToolTip("right arrow") + self.m_button5.SetToolTip("refresh") + self.m_toggleBtn4.SetToolTip("save_configuration") + self.magnifier.SetToolTip("magnifier") + self.rotation.SetToolTip("rotation") + self.flip.SetToolTip("flip") + self.m_button7.SetToolTip("load_configuration") # Different platforms may need to adjust the width of the scrolledWindow_set sys_platform = platform.system() if sys_platform.find("Windows") >= 0: @@ -1327,3 +1337,105 @@ def hidden(self, event): # issue: You need to change the window size, then the scrollbar starts to display. self.scrolledWindow_set.FitInside() self.auto_layout() + + def save_configuration(self, event): + data = { + 'row_col': self.row_col.GetLineText(0), + 'row_col_one_img': self.row_col_one_img.GetLineText(0), + 'show_scale': self.show_scale.GetLineText(0), + 'row_col_img_unit': self.row_col_img_unit.GetLineText(0), + 'gap': self.gap.GetLineText(0), + 'magnifer_row_col': self.magnifer_row_col.GetLineText(0), + 'output_scale': self.output_scale.GetLineText(0), + 'img_resolution': self.img_resolution.GetLineText(0), + 'magnifer_resolution': self.magnifer_resolution.GetLineText(0), + 'magnifier_show_scale': self.magnifier_show_scale.GetLineText(0), + 'line_width': self.line_width.GetLineText(0), + 'magnifier_out_scale': self.magnifier_out_scale.GetLineText(0), + 'title_font_size': self.title_font_size.GetLineText(0), + 'box_position': self.box_position.GetSelection(), + 'choice_normalized_size': self.choice_normalized_size.GetSelection(), + 'choice_output': self.choice_output.GetSelection(), + 'image_interp': self.image_interp.GetSelection(), + 'Magnifier_format': self.Magnifier_format.GetSelection(), + 'title_font': self.title_font.GetSelection(), + 'parallel_sequential': self.parallel_sequential.GetValue(), + 'parallel_to_sequential': self.parallel_to_sequential.GetValue(), + 'auto_save_all': self.auto_save_all.GetValue(), + 'move_file': self.move_file.GetValue(), + 'img_vertical': self.img_vertical.GetValue(), + 'one_img_vertical': self.one_img_vertical.GetValue(), + 'img_unit_vertical': self.img_unit_vertical.GetValue(), + 'magnifer_vertical': self.magnifer_vertical.GetValue(), + 'show_original': self.show_original.GetValue(), + 'show_magnifer': self.show_magnifer.GetValue(), + 'title_show': self.title_show.GetValue(), + 'auto_layout_check': self.auto_layout_check.GetValue(), + 'one_img': self.one_img.GetValue(), + 'onetitle': self.onetitle.GetValue(), + 'customfunc': self.customfunc.GetValue(), + 'show_box': self.show_box.GetValue(), + 'show_box_in_crop': self.show_box_in_crop.GetValue(), + 'select_img_box': self.select_img_box.GetValue(), + 'title_auto': self.title_auto.GetValue(), + 'title_exif': self.title_exif.GetValue(), + 'title_show_parent': self.title_show_parent.GetValue(), + 'title_show_prefix': self.title_show_prefix.GetValue(), + 'title_show_name': self.title_show_name.GetValue(), + 'title_show_suffix': self.title_show_suffix.GetValue(), + 'title_down_up': self.title_down_up.GetValue(), + } + + with open('output.json', 'w') as file: + json.dump(data, file) + + def load_configuration(self, event): + with open('output.json', 'r') as file: + data = json.load(file) + self.row_col.SetValue(data['row_col']) + self.row_col_one_img.SetValue(data['row_col_one_img']) + self.show_scale.SetValue(data['show_scale']) + self.row_col_img_unit.SetValue(data['row_col_img_unit']) + self.gap.SetValue(data['gap']) + self.magnifer_row_col.SetValue(data['magnifer_row_col']) + self.output_scale.SetValue(data['output_scale']) + self.img_resolution.SetValue(data['img_resolution']) + self.magnifer_resolution.SetValue(data['magnifer_resolution']) + self.magnifier_show_scale.SetValue(data['magnifier_show_scale']) + self.line_width.SetValue(data['line_width']) + self.magnifier_out_scale.SetValue(data['magnifier_out_scale']) + self.title_font_size.SetValue(data['title_font_size']) + self.box_position.SetSelection(data['box_position']) + self.choice_normalized_size.SetSelection(data['choice_normalized_size']) + self.choice_output.SetSelection(data['choice_output']) + self.image_interp.SetSelection(data['image_interp']) + self.Magnifier_format.SetSelection(data['Magnifier_format']) + self.title_font.SetSelection(data['title_font']) + self.parallel_sequential.SetValue(data['parallel_sequential']) + self.parallel_to_sequential.SetValue(data['parallel_to_sequential']) + self.auto_save_all.SetValue(data['auto_save_all']) + self.move_file.SetValue(data['move_file']) + self.img_vertical.SetValue(data['img_vertical']) + self.one_img_vertical.SetValue(data['one_img_vertical']) + self.img_unit_vertical.SetValue(data['img_unit_vertical']) + self.magnifer_vertical.SetValue(data['magnifer_vertical']) + self.show_original.SetValue(data['show_original']) + self.show_magnifer.SetValue(data['show_magnifer']) + self.title_show.SetValue(data['title_show']) + self.auto_layout_check.SetValue(data['auto_layout_check']) + self.one_img.SetValue(data['one_img']) + self.onetitle.SetValue(data['onetitle']) + self.customfunc.SetValue(data['customfunc']) + self.show_box.SetValue(data['show_box']) + self.show_box_in_crop.SetValue(data['show_box_in_crop']) + self.select_img_box.SetValue(data['select_img_box']) + self.title_auto.SetValue(data['title_auto']) + self.title_exif.SetValue(data['title_exif']) + self.title_show_parent.SetValue(data['title_show_parent']) + self.title_show_prefix.SetValue(data['title_show_prefix']) + self.title_show_name.SetValue(data['title_show_name']) + self.title_show_suffix.SetValue(data['title_show_suffix']) + self.title_down_up.SetValue(data['title_down_up']) + + +