Skip to content

Commit

Permalink
Cleanup code (#156)
Browse files Browse the repository at this point in the history
* Refactor TextEdit, WIP

* Fix unit tests with language transform

* Separated key commands in TextEdit. Breaks some, TAB functions, Enter..

* Delete commented code, renamve arguments

* Refactor change_locale

* Increase unit tests

* Improve unit test

* Improve unit test

* Change update from develop branch

* Remove comments
  • Loading branch information
HelioGuilherme66 authored Oct 27, 2024
1 parent e80acfc commit a458f47
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 29 deletions.
4 changes: 1 addition & 3 deletions src/robotide/editor/listeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ListEditorBase(wx.Panel):
_buttons_nt = []

def __init__(self, parent, columns, controller, label=None):
__ = label
self._menu = [_('Edit'), _('Move Up\tCtrl-Up'), _('Move Down\tCtrl-Down'), '---', _('Delete')]
wx.Panel.__init__(self, parent)
from ..preferences import RideSettings
Expand Down Expand Up @@ -195,10 +196,7 @@ def __init__(self, parent, columns, color_foreground='black',
self.color_foreground = color_foreground
self.color_background = color_background
self.SetBackgroundColour(Colour(color_background))
# self.SetOwnBackgroundColour(Colour(color_background))
self.SetForegroundColour(Colour(color_foreground))
# self.SetOwnForegroundColour(Colour(color_foreground))
# self.EnableAlternateRowColours(True)
self._parent = parent
self._doc_language = None
self.set_language()
Expand Down
17 changes: 0 additions & 17 deletions src/robotide/preferences/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ def __init__(self, parent, title, preferences, style="auto"):
self.font.SetPointSize(self._general_settings[FONT_SIZE])
self.SetFont(self.font)
self.SetBackgroundColour(Colour(self._general_settings['background']))
## self.SetOwnBackgroundColour(Colour(200, 222, 40))
## self.SetOwnForegroundColour(Colour(7, 0, 70))
# self.SetOwnBackgroundColour(Colour(self._general_settings['secondary background']))
self.SetForegroundColour(Colour(self._general_settings['foreground']))
# self.SetOwnForegroundColour(Colour(self._general_settings['secondary foreground']))
self._closing = False

panels = preferences.preference_panels
Expand Down Expand Up @@ -224,10 +220,6 @@ def __init__(self, *args, **kwargs):
self.title.SetFont(font)
self.title.SetForegroundColour(self.settings['foreground'])
self.title.SetBackgroundColour(self.settings['background'])
# self.title.SetBackgroundColour(Colour(200, 222, 40))
# self.title.SetForegroundColour(Colour(7, 0, 70))
# self.SetBackgroundColour(Colour(200, 222, 40))
# self.SetForegroundColour(Colour(7, 0, 70))
self.SetForegroundColour(self.settings['foreground'])
self.SetBackgroundColour(self.settings['background'])

Expand All @@ -242,17 +234,8 @@ def ShowPanel(self, panel):
if self._current_panel is not None:
self._current_panel.Hide()
self._current_panel = panel
## self.SetForegroundColour(self.settings['foreground'])
## self.SetOwnBackgroundColour(self.settings['background'])
## self.SetOwnForegroundColour(Colour(255, 255, 255))
## self.SetBackgroundColour(self.settings['background'])
panel.SetForegroundColour(self.settings['foreground']) # Critical text all black on
panel.SetBackgroundColour(self.settings['background']) # Black background
## self.SetBackgroundColour(Colour(200, 222, 40))
## self.SetForegroundColour(Colour(7, 0, 70))
## panel.SetBackgroundColour(Colour(200, 222, 40))
## panel.SetForegroundColour(Colour(255, 255, 255))
## panel.SetForegroundColour(Colour(7, 0, 70))
panel.Show()
sizer = self.panels_container.GetSizer()
item = sizer.GetItem(panel)
Expand Down
4 changes: 0 additions & 4 deletions src/robotide/ui/preferences_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class PreferencesPanel(wx.Panel):
def __init__(self, parent=None, name_tr=None, *args, **kwargs):
self.tree_item = None
self.name_tr = name_tr
# self.location = (_("Preferences"),)
# self.title = _("Preferences")
from ..preferences.settings import RideSettings
wx.Panel.__init__(self, parent, *args, **kwargs)
self._gsettings = RideSettings()
Expand Down Expand Up @@ -275,8 +273,6 @@ def set_value(evt):
evt.Skip()
editor.Bind(wx.EVT_KILL_FOCUS, lambda evt: set_value(evt))
elabel = Label(parent, label=label)
# background_color = esettings['background']
# foreground_color = esettings['foreground']
elabel.SetBackgroundColour(background_color)
elabel.SetForegroundColour(foreground_color)
return elabel, editor
2 changes: 0 additions & 2 deletions src/robotide/widgets/htmlwnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def __init__(self, parent, size=wx.DefaultSize, text=None):
self.SetBorders(2)
self.SetStandardFonts(size=9)
self.SetBackgroundColour(Colour(200, 222, 40))
# self.SetOwnBackgroundColour(Colour(200, 222, 40))
# self.SetOwnForegroundColour(Colour(7, 0, 70))
if text:
self.set_content(text)
self.SetHTMLBackgroundColour(Colour(general_settings[BACKGROUND_HELP]))
Expand Down
3 changes: 0 additions & 3 deletions utest/application/test_app_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ def test_replace_std_for_win(self):

class TestMisc(unittest.TestCase):

def tearDown(self):
builtins.__import__ = real_import

def test_get_code(self):
import wx
from robotide.application import RIDE
Expand Down

0 comments on commit a458f47

Please sign in to comment.