Skip to content

Commit

Permalink
allow point saving to work (while 'hightlight not working' investigated)
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Feb 5, 2025
1 parent 62797de commit dbd9f4e
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions larch/wxmap/mapviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,10 @@ def onShow(self, event=None):
highlight = np.zeros((h, w))

highlight[np.where(area[()])] = 1
imd.panel.add_highlight_area(highlight, label=label)
try:
imd.panel.add_highlight_area(highlight, label=label)
except:
print("cannot show area")

def onDone(self, event=None):
self.Destroy()
Expand Down Expand Up @@ -1621,9 +1624,14 @@ def onSavePixel(self, name, ix, iy, x=None, y=None, title=None, xrmfile=None):
update_xrmmap(xrmfile=xrmfile)

# show position on map
self.im_displays[-1].panel.add_highlight_area(tmask, label=name)

try:
self.im_displays[-1].panel.add_highlight_area(tmask, label=name)
except:
print("cannot show area")

# make sure we can save position into database
print("push position ", self.scandb)

if self.scandb is None or self.instdb is None:
return
samplestage = self.instdb.get_instrument(self.inst_name)
Expand Down Expand Up @@ -1811,16 +1819,17 @@ def init_larch(self):
self.datagroups = self.larch.symtable
if ESCAN_CRED is not None:
self.move_callback = self.onMoveToPixel
try:
print("ESCAN ", ESCAN_CRED)
if True: # try:
self.scandb = ScanDB()
self.instdb = InstrumentDB(self.scandb)
self.inst_name = self.scandb.get_info('samplestage_instrument',
default='SampleStage')
print(" ScanDB: %s, Instrument=%s" % (self.scandb.engine, self.inst_name))
except:
etype, emsg, tb = sys.exc_info()
print('Could not connect to ScanDB: %s' % (emsg))
self.scandb = self.instdb = None
# except:
# etype, emsg, tb = sys.exc_info()
# print('Could not connect to ScanDB: %s' % (emsg))
# self.scandb = self.instdb = None

def ShowFile(self, evt=None, filename=None, process_file=True, **kws):
if filename is None and evt is not None:
Expand Down

0 comments on commit dbd9f4e

Please sign in to comment.