Skip to content

Commit ff0b498

Browse files
committed
Revert "Merge pull request #1575 from robotframework/HelioGuilherme66-improvements"
This reverts commit 48a712c, reversing changes made to c843738.
1 parent ccf05b8 commit ff0b498

File tree

14 files changed

+49
-85
lines changed

14 files changed

+49
-85
lines changed

src/robotide/__init__.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,31 @@
3232
from string import Template
3333

3434
errorMessageTemplate = Template("""$reason
35-
You need to install wxPython 2.8.12.1 or 3.0.2 or newer with unicode support \
36-
to run RIDE. wxPython can be downloaded from \
37-
http://sourceforge.net/projects/wxpython/files/wxPython/""")
38-
supported_versions = ["2.8", "3.0"]
35+
You need to install wxPython 2.8.12.1 with unicode support to run RIDE.
36+
wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/""")
37+
supported_versions = ["2.8"]
3938

4039
try:
4140
import wxversion
4241
from wxversion import VersionError
42+
if sys.platform == 'darwin':
43+
supported_versions.append("2.9")
4344
wxversion.select(supported_versions)
4445
import wx
4546
except ImportError as e:
46-
if "no appropriate 64-bit architecture" in "{0}".format(e).lower() and \
47+
if "no appropriate 64-bit architecture" in e.message.lower() and \
4748
sys.platform == 'darwin':
48-
print("python should be executed in 32-bit mode with wxPython on OSX.")
49+
print "python should be executed in 32-bit mode with wxPython on OSX."
4950
else:
50-
print(errorMessageTemplate.substitute(reason="wxPython not found."))
51+
print errorMessageTemplate.substitute(reason="wxPython not found.")
5152
sys.exit(1)
5253
except VersionError:
53-
print(errorMessageTemplate.substitute(reason="Wrong wxPython version."))
54+
print errorMessageTemplate.substitute(reason="Wrong wxPython version.")
5455
sys.exit(1)
5556

5657
if "ansi" in wx.PlatformInfo:
57-
print(errorMessageTemplate.substitute(reason="wxPython with ansi encoding \
58-
is not supported"))
58+
print errorMessageTemplate.substitute(
59+
reason="wxPython with ansi encoding is not supported")
5960
sys.exit(1)
6061

6162

@@ -66,7 +67,7 @@
6667
def main(*args):
6768
noupdatecheck, debug_console, inpath = _parse_args(args)
6869
if len(args) > 3 or '--help' in args:
69-
print(__doc__)
70+
print __doc__
7071
sys.exit()
7172
try:
7273
_run(inpath, not noupdatecheck, debug_console)
@@ -81,7 +82,7 @@ def _parse_args(args):
8182
return False, False, None
8283
noupdatecheck = '--noupdatecheck' in args
8384
debug_console = '--debugconsole' in args
84-
inpath = args[-1] if args[-1] not in ['--noupdatecheck', '--debugconsole']\
85+
inpath = args[-1] if args[-1] not in ['--noupdatecheck', '--debugconsole'] \
8586
else None
8687
return noupdatecheck, debug_console, inpath
8788

@@ -106,17 +107,19 @@ def _show_old_wxpython_warning_if_needed(parent=None):
106107
if wx.VERSION >= (2, 8, 12, 1):
107108
return
108109
title = 'Please upgrade your wxPython installation'
109-
message = ("RIDE officially supports wxPython 2.8.12.1, 3.0.2 and newer \
110-
releases in 3.0 series. Your current version is {0}.\n\n \
111-
Older wxPython versions are known to miss some features used by RIDE.\n \
112-
wxPython 2.8.12.1 packages can be found from\n \
113-
http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/.".format(
114-
wx.VERSION_STRING))
110+
message = ('RIDE officially supports wxPython 2.8.12.1. '
111+
'Your current version is %s.\n\n'
112+
'Older wxPython versions are known to miss some features used by RIDE. '
113+
'Notice also that wxPython 3.0 is not yet supported.\n\n'
114+
'wxPython 2.8.12.1 packages can be found from\n'
115+
'http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/.'
116+
% wx.VERSION_STRING)
115117
style = wx.ICON_EXCLAMATION
116118
if not parent:
117-
_ = wx.App()
118-
parent = wx.Frame(None, size=(0, 0))
119+
_ = wx.PySimpleApp()
120+
parent = wx.Frame(None, size=(0,0))
119121
wx.MessageDialog(parent, message, title, style).ShowModal()
120122

123+
121124
if __name__ == '__main__':
122125
main(sys.argv[1:])

src/robotide/application/application.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ def _get_editor(self):
8888

8989
def _load_data(self):
9090
path = self._initial_path or self._get_latest_path()
91-
# FIXME: Loading suite on startuup causes segfault in OSX.
92-
if path and not context.IS_MAC:
91+
if path:
9392
with self.active_event_loop():
94-
# FIXME: wxPython3 hack
95-
# observer = LoadProgressObserver(self.frame)
96-
self._controller.load_data(path, None)
93+
observer = LoadProgressObserver(self.frame)
94+
self._controller.load_data(path, observer)
9795

9896
def _find_robot_installation(self):
9997
output = utils.run_python_command(

src/robotide/application/pluginconnector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class BrokenPlugin(_PluginConnector):
6565

6666
def __init__(self, error, plugin_class):
6767
name = utils.name_from_class(plugin_class, 'Plugin')
68-
doc = 'The plugin is disabled because it failed to load properly.\n' \
69-
+ 'Error: {}'.format(error)
68+
doc = 'This plugin is disabled because it failed to load properly.\n' \
69+
+ 'Error: ' + error
7070
_PluginConnector.__init__(self, name, doc=doc, error=error)
71-
LOG.error("Taking {} plugin into use failed:\n{}".format(name, error))
71+
LOG.error("Taking %s plugin into use failed:\n%s" % (name, error))
7272

7373
def enable_on_startup(self):
7474
pass

src/robotide/editor/grid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def __init__(self, parent, num_rows, num_cols, popup_creator=None,
3636
self.SetDefaultRenderer(grid.GridCellAutoWrapStringRenderer())
3737
self._clipboard_handler = ClipboardHandler(self)
3838
self._history = _GridState()
39-
self.SetColMinimalAcceptableWidth(70)
4039
self.CreateGrid(num_rows, num_cols)
4140
self._popup_creator = popup_creator or PopupCreator()
4241
self.settings = settings

src/robotide/log/log.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, app):
4040
self._log = []
4141
self._window = None
4242
self._path = os.path.join(
43-
tempfile.gettempdir(), '{0}-ride.log'.format(uuid.uuid4()))
43+
tempfile.gettempdir(), '{}-ride.log'.format(uuid.uuid4()))
4444
self._outfile = None
4545
self._remove_old_log_files()
4646
atexit.register(self._close)
@@ -56,7 +56,7 @@ def _remove_old_log_files(self):
5656
try:
5757
os.remove(fname)
5858
except OSError or IOError as e:
59-
sys.stderr.write("{0}".format(e))
59+
sys.stderr.write("{}".format(e))
6060

6161
@property
6262
def _logfile(self):
@@ -103,36 +103,33 @@ def OnViewLog(self, event):
103103
self.notebook.show_tab(self._window)
104104

105105

106-
class _LogWindow(wx.Panel):
106+
class _LogWindow(wx.TextCtrl):
107107

108108
def __init__(self, notebook, log):
109-
wx.Panel.__init__(self, notebook)
110-
self._output = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
109+
wx.TextCtrl.__init__(
110+
self, notebook, style=wx.TE_READONLY | wx.TE_MULTILINE)
111111
self._log = log
112+
self._create_ui()
112113
self._add_to_notebook(notebook)
113114
self.SetFont(widgets.Font().fixed_log)
114-
self.Bind(wx.EVT_SIZE, self.OnSize)
115115

116116
def _create_ui(self):
117-
self.SetSizer(widgets.VerticalSizer())
118-
self.Sizer.add_expanding(self._output)
117+
sizer = wx.BoxSizer(wx.VERTICAL)
118+
sizer.Add(self)
119+
self.SetSizer(sizer)
119120

120121
def _add_to_notebook(self, notebook):
121-
notebook.add_tab(self, 'RIDE Log', allow_closing=True)
122+
notebook.add_tab(self, 'Log', allow_closing=True)
122123
notebook.show_tab(self)
123-
self._output.SetSize(self.Size)
124124

125125
def close(self, notebook):
126126
notebook.delete_tab(self)
127127

128128
def update_log(self):
129-
self._output.SetValue(self._decode_log(self._log))
129+
self.SetValue(self._decode_log(self._log))
130130

131131
def _decode_log(self, log):
132132
result = ''
133133
for msg in log:
134134
result += _message_to_string(msg)
135135
return result
136-
137-
def OnSize(self, evt):
138-
self._output.SetSize(self.Size)

src/robotide/preferences/saving.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SavingPreferences(widgets.PreferencesPanel):
2424
def __init__(self, settings, *args, **kwargs):
2525
super(SavingPreferences, self).__init__(*args, **kwargs)
2626
self._settings = settings
27-
self.SetSizer(wx.FlexGridSizer(cols=2))
27+
self.SetSizer(wx.FlexGridSizer(rows=7, cols=2))
2828
for editor in self._create_editors(settings):
2929
self._add_editor(editor)
3030

src/robotide/preferences/settings.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ library xml directories = []
2020
txt number of spaces = 4
2121
txt format separator = 'space'
2222
line separator = 'native'
23-
default file format = 'robot'
23+
default file format = 'txt'
2424

2525
[Text Edit]
26-
font size = 9
26+
font size = 8
2727
argument = '#bb8844'
2828
comment = 'black'
2929
error = 'black'
@@ -38,7 +38,7 @@ tc_kw_name = '#aaaaaa'
3838
variable = '#008080'
3939

4040
[Grid]
41-
font size = 9
41+
font size = 8
4242
fixed font = False
4343
col size = 170
4444
max col size = 300

src/robotide/publish/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ def important_action(self):
119119

120120
import os
121121

122-
from robotide.context import WX_VERSION
123-
if WX_VERSION > '3.0':
124-
from wx.lib.pubsub import setuparg1
125-
elif WX_VERSION > '2.9':
126-
from wx.lib.pubsub import setupv1
127122
from messages import *
128123
from publisher import PUBLISHER
129124

src/robotide/publish/messages.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
try:
16-
from wx.lib.pubsub import Publisher
17-
WxPublisher = Publisher()
18-
except ImportError:
19-
from wx.lib.pubsub import pub
20-
WxPublisher = pub.getDefaultPublisher()
2115
import inspect
2216
import sys
2317
import traceback

src/robotide/publish/publisher.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
try:
16-
from wx.lib.pubsub import Publisher
17-
WxPublisher = Publisher()
18-
except ImportError:
19-
from wx.lib.pubsub import pub
20-
WxPublisher = pub.getDefaultPublisher()
21-
2215

2316
class Publisher(object):
2417

@@ -74,7 +67,6 @@ class _ListenerWrapper(object):
7467
def __init__(self, listener, topic):
7568
self.listener = listener
7669
self.topic = self._get_topic(topic)
77-
WxPublisher.subscribe(self, self.topic)
7870

7971
def _get_topic(self, topic):
8072
if not isinstance(topic, basestring):
@@ -88,7 +80,7 @@ def listens(self, topic):
8880
return self._get_topic(topic).startswith(self.topic)
8981

9082
def unsubscribe(self):
91-
WxPublisher.unsubscribe(self, self.topic)
83+
pass
9284

9385
def __call__(self, data):
9486
from messages import RideLogException

0 commit comments

Comments
 (0)