Skip to content

Commit

Permalink
fix bug for roi manager
Browse files Browse the repository at this point in the history
  • Loading branch information
qixinbo committed Aug 1, 2022
1 parent 3c378eb commit fa5d841
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
imagepy/data/config.json
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
2 changes: 1 addition & 1 deletion imagepy/data/config.json
Original file line number Diff line number Diff line change
@@ -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]]
[["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]]
12 changes: 8 additions & 4 deletions imagepy/menus/Selection/roiwindow_wgt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit fa5d841

Please sign in to comment.