Skip to content

Commit 3a4b2ef

Browse files
Janne Härkönenyanne
authored andcommitted
fix issues preventing startup and unit test execution
1 parent f5b2805 commit 3a4b2ef

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

src/robotide/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
try:
4040
import wxversion
4141
from wxversion import VersionError
42-
if sys.platform == 'darwin':
43-
supported_versions.append("2.9")
42+
if sys.platform == 'darwin': # CAN NOT IMPORT IS_MAC AS THERE IS A wx IMPORT
43+
supported_versions.append("3.0")
4444
wxversion.select(supported_versions)
4545
import wx
4646
except ImportError as e:

src/robotide/publish/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ 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
122127
from messages import *
123128
from publisher import PUBLISHER
124129

src/robotide/publish/messages.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
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()
1521
import inspect
1622
import sys
1723
import traceback

src/robotide/publish/publisher.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
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+
1522

1623
class Publisher(object):
1724

@@ -67,6 +74,7 @@ class _ListenerWrapper(object):
6774
def __init__(self, listener, topic):
6875
self.listener = listener
6976
self.topic = self._get_topic(topic)
77+
WxPublisher.subscribe(self, self.topic)
7078

7179
def _get_topic(self, topic):
7280
if not isinstance(topic, basestring):
@@ -80,7 +88,7 @@ def listens(self, topic):
8088
return self._get_topic(topic).startswith(self.topic)
8189

8290
def unsubscribe(self):
83-
pass
91+
WxPublisher.unsubscribe(self, self.topic)
8492

8593
def __call__(self, data):
8694
from messages import RideLogException

src/robotide/ui/tree.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
import wx
1616
from wx.lib.agw import customtreectrl
1717
from wx.lib.mixins import treemixin
18+
try:
19+
from wx import ColorRGB as Colour
20+
except ImportError:
21+
from wx import Colour
1822

1923
from robotide.controller.ui.treecontroller import TreeController, \
2024
TestSelectionController
@@ -283,7 +287,7 @@ def _create_node_with_handler(self, parent_node, controller, index=None):
283287
index, with_checkbox=(handler_class == TestCaseHandler and self._checkboxes_for_tests))
284288
if isinstance(controller, ResourceFileController):
285289
if not controller.is_used():
286-
self.SetItemTextColour(node, wx.ColorRGB(0xA9A9A9))
290+
self.SetItemTextColour(node, Colour(0xA9, 0xA9, 0xA9))
287291
self.SetPyData(node, handler_class(controller, self, node, self._controller.settings))
288292
if controller.is_excluded():
289293
self._set_item_excluded(node)

0 commit comments

Comments
 (0)