Skip to content

Commit fa5d841

Browse files
committed
fix bug for roi manager
1 parent 3c378eb commit fa5d841

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
imagepy/data/config.json
12
# Byte-compiled / optimized / DLL files
23
__pycache__/
34
*.py[cod]

imagepy/data/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +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]]
1+
[["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]]

imagepy/menus/Selection/roiwindow_wgt.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def on_add(self, event):
232232
Macros('', ['ROI Add>None']).start(self.app, callafter=self.UpdateData)
233233

234234
def on_add_nameless(self, event):
235-
ips = ImageManager.get()
235+
ips = self.app.get_img()
236236
if ips is None: return self.app.alert('No image opened!')
237237
if ips.roi is None: return self.app.alert('No Roi found!')
238238
Macros('', ['ROI Add>{"name":"%s-roi"}'%ips.title]).start(self.app, callafter=self.UpdateData)
@@ -313,10 +313,14 @@ def on_setting(self, event):
313313
Macros('', ['ROI Setting>None']).start(self.app)
314314

315315
def UpdateData(self):
316-
names = self.app.manager('roi').gets('name')
317-
objs = self.app.manager('roi').gets('obj')
318-
types = [ROI(mark2shp(i)).roitype for i in objs]
316+
names = self.app.manager('roi').names()
317+
if len(names) == 0:
318+
objs = []
319+
else:
320+
objs = self.app.manager('roi').gets()
321+
types = [ROI(mark2shp(i[1])).roitype for i in objs]
319322
self.lst_rois.SetValue(list(zip(names, types)))
323+
self.lst_rois.Refresh()
320324

321325
def __del__( self ):
322326
pass

0 commit comments

Comments
 (0)