Skip to content

Commit

Permalink
Merge pull request #457 from nucleic/example-fixes
Browse files Browse the repository at this point in the history
Example fixes
  • Loading branch information
MatthieuDartiailh committed Feb 9, 2022
2 parents b849cf7 + dff5957 commit 6f0f933
Show file tree
Hide file tree
Showing 44 changed files with 111 additions and 105 deletions.
20 changes: 10 additions & 10 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
main_doc = 'index'

# General information about the project.
project = u'Enaml'
copyright = u'2013-2020, Nucleic Development Team'
project = 'Enaml'
copyright = '2013-2021, Nucleic Development Team'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -248,8 +248,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'enaml.tex', u'Enaml Documentation',
u'Nucleic Development Team', 'manual'),
('index', 'enaml.tex', 'Enaml Documentation',
'Nucleic Development Team', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -281,18 +281,18 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'enaml', u'Enaml Documentation',
[u'Nucleic Development Team'], 1)
('index', 'enaml', 'Enaml Documentation',
'Nucleic Development Team', 1)
]


# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Enaml'
epub_author = u'Chris Colbert'
epub_publisher = u'Nucleic Development Team'
epub_copyright = u'2013, Nucleic Development Team'
epub_title = 'Enaml'
epub_author = 'Chris Colbert'
epub_publisher = 'Nucleic Development Team'
epub_copyright = '2013-2021, Nucleic Development Team'

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand Down
5 changes: 2 additions & 3 deletions enaml/core/compiler_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ def safe_eval_ast(cg, node, name, lineno, local_names):
This method will eval the python code represented by the ast
in the local namespace. If the code would have the side effect
of storing a value in the namespace, such as a list comp under
Python 2, then the expression will be evaluated in it's own
namespace.
of storing a value in the namespace, then the expression will be evaluated
in it's own namespace.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/docking/q_bitmap_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class QCheckedBitmapButton(QBitmapButton):
""" A bitmap button subclass which supports a checked bitmap.
"""
_tool_tip = u''
_checked_tool_tip = u''
_tool_tip = ''
_checked_tool_tip = ''
_checked_bitmap = None

def __init__(self, parent=None):
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/docking/q_dock_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def onAlerted(self, level):
""" A slot which can be connected to an 'alerted' signal.
"""
self.setProperty(u'alert', level or None)
self.setProperty('alert', level or None)
repolish(self)

#--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/docking/q_dock_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def title(self):
item = self.dockItem()
if item is not None:
return item.title()
return u''
return ''

def icon(self):
""" Get the icon for the container.
Expand Down
10 changes: 5 additions & 5 deletions enaml/qt/docking/q_dock_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def clearAlert(self):
self._alert_data = None
app = QApplication.instance()
app.focusChanged.disconnect(self._onAppFocusChanged)
self.alerted.emit(u'')
self.alerted.emit('')

#--------------------------------------------------------------------------
# Private API
Expand All @@ -760,7 +760,7 @@ def _onAlertTimer(self):
data.remaining -= 1
if data.remaining > 0:
data.timer.start(data.off)
self.alerted.emit(u'')
self.alerted.emit('')
elif data.persist:
data.timer.stop()
self.alerted.emit(data.level)
Expand All @@ -778,9 +778,9 @@ def _onAlerted(self, level):
level = level or None
title_bar = self.titleBarWidget()
label = title_bar.label()
self.setProperty(u'alert', level)
title_bar.setProperty(u'alert', level)
label.setProperty(u'alert', level)
self.setProperty('alert', level)
title_bar.setProperty('alert', level)
label.setProperty('alert', level)
repolish(label)
repolish(title_bar)
repolish(self)
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/docking/q_dock_tab_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _snapAlertPixmaps(self, index, level):
"""
# Force an internal update of the stylesheet rules
self.setProperty(u'alert', level)
self.setProperty('alert', level)
repolish(self)

# Setup the style option for the control
Expand All @@ -208,7 +208,7 @@ def _snapAlertPixmaps(self, index, level):
painter.drawControl(QStyle.CE_TabBarTab, opt)

# Reset the internal stylesheet style
self.setProperty(u'alert', None)
self.setProperty('alert', None)
repolish(self)

# Update the internal tab data
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/docking/q_text_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, parent=None):
super(QTextLabel, self).__init__(parent)
self._min_text_size = QSize()
self._text_size = QSize()
self._text = u''
self._text = ''

#--------------------------------------------------------------------------
# Private API
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/docking/style_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_style_sheet(name):
""" This is a deprecated function.
"""
return _style_sheets.get(name, u'')
return _style_sheets.get(name, '')


def register_style_sheet(name, sheet):
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/qt_color_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_default_title(self):
""" Get the default window title for the color dialog.
"""
return u'Select Color'
return 'Select Color'

#--------------------------------------------------------------------------
# Signal Handlers
Expand Down
6 changes: 3 additions & 3 deletions enaml/qt/qt_dock_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,16 @@ def refresh_style_sheet(self):
"""
# workaround win-7 sizing bug
parts = [u'QDockTabWidget::pane {}']
parts = ['QDockTabWidget::pane {}']
name = self.widget.objectName()
for style in StyleCache.styles(self.declaration):
t = translate_dock_area_style(name, style)
if t:
parts.append(t)
if len(parts) > 1:
stylesheet = u'\n\n'.join(parts)
stylesheet = '\n\n'.join(parts)
else:
stylesheet = u''
stylesheet = ''
self.widget.setStyleSheet(stylesheet)

#--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/qt_dock_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def refresh_style_sheet(self):
if t:
parts.append(t)
if len(parts) > 0:
stylesheet = u'\n\n'.join(parts)
stylesheet = '\n\n'.join(parts)
else:
stylesheet = u''
stylesheet = ''
self.widget.setStyleSheet(stylesheet)

#--------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions enaml/qt/qt_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def _set_error_state(self):
# A temporary hack until styles are implemented
if not self._guard & ERROR_FLAG:
self._guard |= ERROR_FLAG
s = u'QLineEdit { border: 2px solid red; background: rgb(255, 220, 220); }'
s = 'QLineEdit { border: 2px solid red; background: rgb(255, 220, 220); }'
self.widget.setStyleSheet(s)
v = self.declaration.validator
self.widget.setToolTip(v and v.message or u'')
self.widget.setToolTip(v and v.message or '')

def _clear_error_state(self):
""" Clear the error state of the widget.
Expand All @@ -129,7 +129,7 @@ def _clear_error_state(self):
# Replace the widget's "error" stylesheet with
# the one defined in the declaration
self.refresh_style_sheet()
self.widget.setToolTip(u'')
self.widget.setToolTip('')

def _maybe_valid(self, text):
""" Get whether the text is valid or can be valid.
Expand Down
8 changes: 4 additions & 4 deletions enaml/qt/qt_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ def refresh_tab_bar_style_sheet(self):
if t:
parts.append(t)
if len(parts) > 0:
stylesheet = u'\n\n'.join(parts)
stylesheet = '\n\n'.join(parts)
else:
stylesheet = u''
stylesheet = ''
self.widget.tabBar().setStyleSheet(stylesheet)

#--------------------------------------------------------------------------
Expand Down Expand Up @@ -487,7 +487,7 @@ def init_selected_tab(self):
self.set_selected_tab(d.selected_tab)
else:
current = self.widget.currentWidget()
name = current.objectName() if current is not None else u''
name = current.objectName() if current is not None else ''
self._guard |= CHANGE_GUARD
try:
d.selected_tab = name
Expand Down Expand Up @@ -532,7 +532,7 @@ def on_current_changed(self):
self._guard |= CHANGE_GUARD
try:
page = self.widget.currentWidget()
name = page.objectName() if page is not None else u''
name = page.objectName() if page is not None else ''
self.declaration.selected_tab = name
finally:
self._guard &= ~CHANGE_GUARD
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/qt_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def __init__(self, *args, **kwargs):
"""
super(QPage, self).__init__(*args, **kwargs)
self._title = u''
self._tool_tip = u''
self._title = ''
self._tool_tip = ''
self._icon = QIcon()
self._closable = True
self._is_enabled = True
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/qt_toolkit_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_default_title(self):
window title. The base implementation returns an empty string.
"""
return u''
return ''

#--------------------------------------------------------------------------
# Signal Handlers
Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/qt_toolkit_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def init_widget(self):
# engine applies the cascade itself). Names provided by the
# widget author are assumed to be unique.
d = self.declaration
name = d.name or u'obj-%d' % id(d)
name = d.name or 'obj-%d' % id(d)
widget.setObjectName(name)

def init_layout(self):
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/qt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def refresh_style_sheet(self):
if t:
parts.append(t)
if len(parts) > 0:
stylesheet = u'\n\n'.join(parts)
stylesheet = '\n\n'.join(parts)
else:
stylesheet = u''
stylesheet = ''
self.widget.setStyleSheet(stylesheet)

def tab_focus_request(self, reason):
Expand Down
2 changes: 1 addition & 1 deletion enaml/scintilla/scintilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def get_text(self):
"""
if self.proxy_is_active:
return self.proxy.get_text()
return u''
return ''

def set_text(self, text):
""" Set the text in the current document.
Expand Down
8 changes: 4 additions & 4 deletions enaml/stdlib/dock_area_styles.enaml
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ template MetroStyle():
# Registry
#------------------------------------------------------------------------------
__STYLE_REGISTRY = {
u'vs-2010': VS2010Style,
u'grey-wind': GreyWindStyle,
u'new-moon': NewMoonStyle,
u'metro': MetroStyle
'vs-2010': VS2010Style,
'grey-wind': GreyWindStyle,
'new-moon': NewMoonStyle,
'metro': MetroStyle
}


Expand Down
2 changes: 1 addition & 1 deletion enaml/stdlib/message_box.enaml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ template _BodyCommand(HasDetails: True):
template _MessageBoxBody(HasImage, HasContent, HasDetails):
TaskDialogInstructionArea:
Label:
text = nonlocals(1).text or u''
text = nonlocals(1).text or ''
style_class = 'task-dialog-instructions'
_BodyImage(HasImage): pass
_BodyContent(HasContent): pass
Expand Down
2 changes: 1 addition & 1 deletion enaml/styling.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _comma_split(text):
return cache[text]
if len(cache) >= _MAX_CACHE:
cache.clear()
result = tuple(s.strip() for s in text.split(u',') if s)
result = tuple(s.strip() for s in text.split(',') if s)
cache[text] = result
return result

Expand Down
2 changes: 1 addition & 1 deletion enaml/widgets/combo_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_selected_item(self):
items = self.items
idx = self.index
if idx < 0 or idx >= len(items):
return u''
return ''
return items[idx]

#--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion enaml/widgets/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ def field_text(self):
"""
if self.proxy_is_active:
return self.proxy.field_text()
return u''
return ''
4 changes: 2 additions & 2 deletions enaml/widgets/file_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def exec_(self):
self.proxy.exec_()
if self.result == 'accepted':
return self.path
return u''
return ''

#--------------------------------------------------------------------------
# Utility Methods
Expand All @@ -142,7 +142,7 @@ def _handle_close(self, result, paths, selected_filter):
self.result = result
if result == 'accepted':
self.paths = paths
self.path = paths[0] if paths else u''
self.path = paths[0] if paths else ''
self.selected_filter = selected_filter
self.accepted(self.path)
else:
Expand Down
8 changes: 4 additions & 4 deletions enaml/widgets/file_dialog_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_existing_directory(parent=None, **kwargs):
if dialog.exec_native():
if dialog.selected_paths:
return dialog.selected_paths[0]
return u''
return ''

@staticmethod
def get_open_file_name(parent=None, **kwargs):
Expand All @@ -128,7 +128,7 @@ def get_open_file_name(parent=None, **kwargs):
if dialog.exec_native():
if dialog.selected_paths:
return dialog.selected_paths[0]
return u''
return ''

@staticmethod
def get_open_file_names(parent=None, **kwargs):
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_save_file_name(parent=None, **kwargs):
if dialog.exec_native():
if dialog.selected_paths:
return dialog.selected_paths[0]
return u''
return ''

def exec_native(self):
""" Open the dialog using a native OS dialog if available.
Expand Down Expand Up @@ -223,4 +223,4 @@ def _prepare(self):
"""
super(FileDialogEx, self)._prepare()
self.selected_paths = []
self.selected_name_filter = u''
self.selected_name_filter = ''

0 comments on commit 6f0f933

Please sign in to comment.