Skip to content

Commit

Permalink
[update] address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nandishjpatel committed Jan 22, 2024
1 parent e4f3751 commit 97fff05
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 42 deletions.
33 changes: 0 additions & 33 deletions src/odemis/gui/comp/_constants.py

This file was deleted.

5 changes: 4 additions & 1 deletion src/odemis/gui/comp/fastem.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
FG_COLOUR_BUTTON
from odemis.gui import img
from odemis.gui.comp import buttons
from odemis.gui.comp._constants import CAPTION_PADDING_RIGHT, EVT_STREAM_REMOVE, ICON_WIDTH, ICON_HEIGHT
from odemis.gui.comp.combo import ComboBox
from odemis.gui.comp.foldpanelbar import FoldPanelItem
from odemis.gui.comp.slider import UnitFloatSlider
from odemis.gui.comp.text import PatternValidator
from odemis.gui.evt import EVT_STREAM_REMOVE
import wx
import wx.lib.newevent

CAPTION_PADDING_RIGHT = 5
ICON_WIDTH, ICON_HEIGHT = 16, 16


class FastEMProjectPanelHeader(wx.Control):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/odemis/gui/comp/stream_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from odemis import acq
from odemis.gui import FG_COLOUR_BUTTON
from odemis.gui.comp import buttons
from odemis.gui.comp._constants import EVT_STREAM_REMOVE
from odemis.gui.comp.foldpanelbar import FoldPanelItem
from odemis.gui.evt import EVT_STREAM_REMOVE
import wx


Expand Down
16 changes: 9 additions & 7 deletions src/odemis/gui/comp/stream_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
FG_COLOUR_DIS, FG_COLOUR_RADIO_ACTIVE
from odemis.gui import img
from odemis.gui.comp import buttons
from odemis.gui.comp._constants import (stream_remove_event, CAPTION_PADDING_RIGHT,
ICON_HEIGHT, ICON_WIDTH)
from odemis.gui.comp.buttons import ImageTextButton
from odemis.gui.comp.combo import ComboBox, ColorMapComboBox
from odemis.gui.comp.file import FileBrowser
Expand All @@ -41,6 +39,7 @@
from odemis.gui.comp.slider import UnitFloatSlider, VisualRangeSlider, UnitIntegerSlider, Slider
from odemis.gui.comp.stream_bar import StreamBar
from odemis.gui.comp.text import SuggestTextCtrl, UnitFloatCtrl, FloatTextCtrl, UnitIntegerCtrl
from odemis.gui.evt import StreamRemoveEvent
from odemis.gui.util import call_in_wx_main
from odemis.gui.util.widgets import VigilantAttributeConnector
from odemis.model import TINT_FIT_TO_RGB, TINT_RGB_AS_IS
Expand All @@ -49,8 +48,8 @@
from odemis.gui.conf.data import COLORMAPS
import matplotlib.colors as colors

stream_visible_event, EVT_STREAM_VISIBLE = wx.lib.newevent.NewEvent()
stream_peak_event, EVT_STREAM_PEAK = wx.lib.newevent.NewEvent()
StreamVisibleEvent, EVT_STREAM_VISIBLE = wx.lib.newevent.NewEvent()
StreamPeakEvent, EVT_STREAM_PEAK = wx.lib.newevent.NewEvent()

# Values to control which option is available
OPT_NAME_EDIT = 1 # allow the renaming of the stream (for one time only)
Expand All @@ -64,6 +63,9 @@

TINT_CUSTOM_TEXT = u"Custom tint…"

CAPTION_PADDING_RIGHT = 5
ICON_WIDTH, ICON_HEIGHT = 16, 16


@decorator
def control_bookkeeper(f, self, *args, **kwargs):
Expand Down Expand Up @@ -688,17 +690,17 @@ def on_remove_btn(self, evt):
logging.debug("Remove button clicked for '%s'", self.stream.name.value)

# generate EVT_STREAM_REMOVE
event = stream_remove_event(spanel=self)
event = StreamRemoveEvent(spanel=self)
wx.PostEvent(self, event)

def on_visibility_btn(self, evt):
# generate EVT_STREAM_VISIBLE
event = stream_visible_event(visible=self._header.btn_show.GetToggle())
event = StreamVisibleEvent(visible=self._header.btn_show.GetToggle())
wx.PostEvent(self, event)

def on_peak_btn(self, evt):
# generate EVT_STREAM_PEAK
event = stream_peak_event(state=self._header.btn_peak.GetState())
event = StreamPeakEvent(state=self._header.btn_peak.GetState())
wx.PostEvent(self, event)

@staticmethod
Expand Down
5 changes: 5 additions & 0 deletions src/odemis/gui/evt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""
import wx
import wx.lib.newevent

# Custom events created for the Powermate rotating knob
_EVT_KNOB_ROTATE_type = wx.NewEventType()
Expand Down Expand Up @@ -60,3 +61,7 @@ def ControlDown(self):

def AltDown(self):
return wx.GetKeyState(wx.WXK_ALT)


# Used by StreamPanel, StreamBar, FastEMProjectList
StreamRemoveEvent, EVT_STREAM_REMOVE = wx.lib.newevent.NewEvent()

0 comments on commit 97fff05

Please sign in to comment.