Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Bug: Multiple Custom Viewers #810

Merged
merged 1 commit into from
Jun 27, 2016

Conversation

astrofrog
Copy link
Member

Hello All,

Recently written a couple of custom viewers that work well on their own but fall over when imported in the same config. I have boiled it down to the simple setup that produces the errors. The two custom viewers below are fine on their own but cause errors when imported together.

config file:

import widget1,widget2

widget1:

from glue.qt.custom_viewer import CustomViewer
class MyWidget1(CustomViewer):  
    text_box1_Widget1 = '_Hello'

    def setup(self,text_box1_Widget1):
        print('MyWidget1')
        print('text_box1_Widget1: '+text_box1_Widget1)

widget2:

from glue.qt.custom_viewer import CustomViewer
class MyWidget2(CustomViewer):    
    text_box1_Widget2 = '_Hello'
    text_box2_Widget2 = '_world'

    def setup(self,text_box1_Widget2,text_box2):
        print('MyWidget2')
        print('text_box1_Widget2: '+text_box1_Widget2)
        print('text_box2_Widget2: '+text_box2_Widget2)

They produce the following when a widget is added to the glueviz screen:

Traceback (most recent call last):
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 249, in introspect_and_call
    a = [settings(item) for item in a]
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 249, in <listcomp>
    a = [settings(item) for item in a]
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 303, in __call__
    raise MissingSettingError(key)
glue.qt.custom_viewer.MissingSettingError: 'text_box1_Widget2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\widgets\glue_mdi_area.py", line 70, in mousePressEvent
    self._application.choose_new_data_viewer()
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\glue_application.py", line 684, in choose_new_data_viewer
    return self.do(cmd)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\core\application_base.py", line 169, in do
    self._cmds.do(command)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\core\command.py", line 125, in do
    result = cmd.do(self._session)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\core\command.py", line 215, in do
    v = session.application.new_data_viewer(self.viewer, self.data)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\widgets\mpl_widget.py", line 38, in wrapper
    result = func(*args, **kwargs)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\core\application_base.py", line 72, in new_data_viewer
    c = viewer_class(self._session)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 880, in __init__
    coordinator=self._coordinator)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 837, in __init__
    self._coordinator.setup()
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 769, in _call_udf
    result = introspect_and_call(func, settings)
  File "C:\Users\ckennedy\AppData\Local\Continuum\Anaconda3\lib\site-packages\glue\qt\custom_viewer.py", line 258, in introspect_and_call
    (missing, setting_list))
glue.qt.custom_viewer.MissingSettingError: 'This custom viewer is trying to use an unrecognized variable named text_box1_Widget2\n. Valid variable names are\n -layer\n -text_box1_Widget1\n -style'

There seems to be a conflict in the calls to 'setup'.

Thanks,

Chris

@astrofrog
Copy link
Member

Thanks for the simple example! Will investigate.

@jareddeutsch
Copy link

I'm running into this issue as well - so far I haven't been able to find a solution.

@astrofrog
Copy link
Member

@jareddeutsch @c443 - sorry for the delay in investigating this. I've attached a fix and regression test. I'm planning on releasing 0.8.2 soon, which should include this fix.

…erly if the user did not override _custom_functions.
@astrofrog astrofrog merged commit 66699da into glue-viz:master Jun 27, 2016
@jareddeutsch
Copy link

Thanks @astrofrog - I ran a quick test and this fixes the issue for me!

astrofrog added a commit that referenced this pull request Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants