Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-09-22 20:17:18 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-09-22 20:17:18 (GMT)
commit7771593d2c7175c6512cf0b622dc42af1e975883 (patch)
treeb864fdaf72e78c25068c8d9f12b7090077be381d
parent49fae193659f81ba32dc69385c68fb07519c9429 (diff)
hasattr(tw,"activity")
-rw-r--r--NEWS2
-rw-r--r--talogo.py22
-rw-r--r--tawindow.py28
3 files changed, 28 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index c78b2e0..dffc2d7 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@
* chmod +x svg factory
* added missing import gettext from talogo.py
+* renamed xo-man to xo-child
+* caught missing attribute when running from outside of Sugar
68
diff --git a/talogo.py b/talogo.py
index 66df4b9..21eb864 100644
--- a/talogo.py
+++ b/talogo.py
@@ -166,10 +166,11 @@ def setup_cmd(lc, str):
def start_eval(lc, list):
icall(lc, evline, list); yield True
# turn off stop icon when execution is finished
- try:
- lc.tw.activity.stop.set_icon("stopitoff")
- except:
- lc.tw.activity.projectToolbar.stop.set_icon("stopitoff")
+ if hasattr(lc.tw,"activity"):
+ try:
+ lc.tw.activity.stop.set_icon("stopitoff")
+ except:
+ lc.tw.activity.projectToolbar.stop.set_icon("stopitoff")
yield False
def evline(lc, list):
@@ -947,12 +948,13 @@ def hideblocks(lc):
hideshow_button(lc.tw)
for i in lc.tw.selbuttons:
hide(i)
- try:
- # Use new toolbar design
- lc.tw.activity.do_hide()
- except:
- # Use old toolbar design
- lc.tw.activity.projectToolbar.do_hide()
+ if hasattr(lc.tw,"activity"):
+ try:
+ # Use new toolbar design
+ lc.tw.activity.do_hide()
+ except:
+ # Use old toolbar design
+ lc.tw.activity.projectToolbar.do_hide()
def doevalstep(lc):
starttime = millis()
diff --git a/tawindow.py b/tawindow.py
index 731d8e2..bb6567e 100644
--- a/tawindow.py
+++ b/tawindow.py
@@ -589,7 +589,7 @@ def keypress_cb(area, event, tw):
else:
alt_mask = False
results = key_press(tw, alt_mask, keyname, keyunicode)
- if keyname is not None and \
+ if keyname is not None and hasattr(tw,"activity") and \
hasattr(tw.activity, 'chattube') and tw.activity.chattube is not None:
# print "key press"
if alt_mask:
@@ -782,19 +782,19 @@ def xy(event):
return map(int, event.get_coords())
def showPopup(block_name,tw):
- try:
- label = _(block_name) + ": " + hover_dict[block_name]
- except:
- label = _(block_name)
- try:
- # Use new toolbar
- tw.activity.hover_help_label.set_text(label)
- tw.activity.hover_help_label.show()
- except:
- # Use old toolbar
- tw.activity.helpToolbar.hover_help_label.set_text(label)
- tw.activity.helpToolbar.hover_help_label.show()
-
+ if hasattr(tw,"activity"):
+ try:
+ label = _(block_name) + ": " + hover_dict[block_name]
+ except:
+ label = _(block_name)
+ try:
+ # Use new toolbar
+ tw.activity.hover_help_label.set_text(label)
+ tw.activity.hover_help_label.show()
+ except:
+ # Use old toolbar
+ tw.activity.helpToolbar.hover_help_label.set_text(label)
+ tw.activity.helpToolbar.hover_help_label.show()
"""
i = popupHandler.getInvoker(block_name)
if i: