diff --git a/.gitignore b/.gitignore index ad1fb101..9002b892 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +imagepy/data/config.json # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/imagepy/data/config.json b/imagepy/data/config.json index fe7b9a33..b7722ba7 100644 --- a/imagepy/data/config.json +++ b/imagepy/data/config.json @@ -1 +1 @@ -[["uistyle", "imagepy", null], ["mea_style", {"color": [0, 0, 255], "fcolor": [255, 255, 255], "fill": false, "lw": 2, "tcolor": [0, 255, 0], "size": 12}, null], ["mark_style", {"color": [0, 255, 0], "fcolor": [255, 255, 255], "fill": false, "lw": 1, "tcolor": [255, 0, 0], "size": 8}, null], ["recent", ["C:/Users/54631/Desktop/\u6d77\u51b0\u62a5\u4ef7/testmacros.mc", "C:\\Users\\Administrator\\Downloads\\\u7d20\u6750\u2014\u8f66\u5934\\\u6d4b\u8bd5-JK1-\u52ff\u5220\\20170201\\In-20170201151126911-\u6842J73220-\u9ec4-qj-1.jpg", "C:/Users/Administrator/Desktop/imagepy/imagepy/plugins/demoplugin/menus/Demos/Macros Demo/Macros Gaussian Invert.mc", "DEM.mc"], null], ["roi_style", {"color": [255, 255, 0], "fcolor": [255, 255, 255], "fill": false, "lw": 1, "tcolor": [255, 255, 0], "size": 8}, null], ["language", "English", null]] \ No newline at end of file +[["language", "English", null], ["roi_style", {"color": [255, 255, 0], "fcolor": [255, 255, 255], "fill": false, "lw": 1, "tcolor": [255, 255, 0], "size": 8}, null], ["recent", ["C:/Users/54631/Desktop/\u6d77\u51b0\u62a5\u4ef7/testmacros.mc", "C:\\Users\\Administrator\\Downloads\\\u7d20\u6750\u2014\u8f66\u5934\\\u6d4b\u8bd5-JK1-\u52ff\u5220\\20170201\\In-20170201151126911-\u6842J73220-\u9ec4-qj-1.jpg", "C:/Users/Administrator/Desktop/imagepy/imagepy/plugins/demoplugin/menus/Demos/Macros Demo/Macros Gaussian Invert.mc", "DEM.mc"], null], ["mark_style", {"color": [0, 255, 0], "fcolor": [255, 255, 255], "fill": false, "lw": 1, "tcolor": [255, 0, 0], "size": 8}, null], ["mea_style", {"color": [0, 0, 255], "fcolor": [255, 255, 255], "fill": false, "lw": 2, "tcolor": [0, 255, 0], "size": 12}, null], ["uistyle", "imagepy", null]] \ No newline at end of file diff --git a/imagepy/menus/Selection/roiwindow_wgt.py b/imagepy/menus/Selection/roiwindow_wgt.py index 778242e6..f2663a28 100644 --- a/imagepy/menus/Selection/roiwindow_wgt.py +++ b/imagepy/menus/Selection/roiwindow_wgt.py @@ -232,7 +232,7 @@ def on_add(self, event): Macros('', ['ROI Add>None']).start(self.app, callafter=self.UpdateData) def on_add_nameless(self, event): - ips = ImageManager.get() + ips = self.app.get_img() if ips is None: return self.app.alert('No image opened!') if ips.roi is None: return self.app.alert('No Roi found!') Macros('', ['ROI Add>{"name":"%s-roi"}'%ips.title]).start(self.app, callafter=self.UpdateData) @@ -313,10 +313,14 @@ def on_setting(self, event): Macros('', ['ROI Setting>None']).start(self.app) def UpdateData(self): - names = self.app.manager('roi').gets('name') - objs = self.app.manager('roi').gets('obj') - types = [ROI(mark2shp(i)).roitype for i in objs] + names = self.app.manager('roi').names() + if len(names) == 0: + objs = [] + else: + objs = self.app.manager('roi').gets() + types = [ROI(mark2shp(i[1])).roitype for i in objs] self.lst_rois.SetValue(list(zip(names, types))) + self.lst_rois.Refresh() def __del__( self ): pass \ No newline at end of file