Skip to content

Commit

Permalink
Allow workspaces to be created in add_channel()
Browse files Browse the repository at this point in the history
  • Loading branch information
ejeschke committed Aug 22, 2024
1 parent cd0c4bc commit 7ecbab7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ginga/rv/Control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,16 +1128,20 @@ def add_workspace(self, wsname, wstype, inSpace=None, use_toolbar=True):

# CHANNEL MANAGEMENT

def add_image(self, imname, image, chname=None, silent=False):
def add_image(self, imname, image, chname=None, wsname=None, silent=False):
if chname is None:
channel = self.get_current_channel()
if channel is None:
raise ValueError("Need to provide a channel name to add "
"the image")
chname = channel.name

if self.has_channel(chname):
channel = self.get_channel(chname)
else:
channel = self.add_channel(chname, workspace=wsname)

# add image to named channel
channel = self.get_channel_on_demand(chname)
channel.add_image(image, silent=silent)

def advertise_image(self, chname, image):
Expand Down Expand Up @@ -1428,6 +1432,10 @@ def add_channel(self, chname, workspace=None,
channel = Channel(chname, self, datasrc=None,
settings=settings)

if workspace is not None:
if not self.ds.has_ws(workspace):
self.add_workspace(workspace, 'tabs')

bnch = self.add_viewer(chname, settings,
workspace=workspace)
# for debugging
Expand Down

0 comments on commit 7ecbab7

Please sign in to comment.