Merge branch 'master' of github.com:sugarlabs/sugar-toolkit-gtk3

This commit is contained in:
translation server 2016-03-04 20:10:35 +00:00
commit 270d7bbd86
7 changed files with 35 additions and 42 deletions

View File

@ -1,4 +1,4 @@
AC_INIT([sugar-toolkit-gtk3],[0.107.2],[],[sugar-toolkit-gtk3])
AC_INIT([sugar-toolkit-gtk3],[0.108.0],[],[sugar-toolkit-gtk3])
AC_PREREQ([2.59])

View File

@ -38,6 +38,7 @@ import os
import tempfile
import subprocess
import pwd
import shutil
_SHELL_SERVICE = 'org.laptop.Shell'
_SHELL_PATH = '/org/laptop/Shell'
@ -67,26 +68,30 @@ def create_activity_id():
return util.unique_id()
def _mkdir(path):
try:
os.mkdir(path)
except OSError, e:
if e.errno != EEXIST:
raise e
def get_environment(activity):
environ = os.environ.copy()
bin_path = os.path.join(activity.get_path(), 'bin')
activity_root = env.get_profile_path(activity.get_bundle_id())
if not os.path.exists(activity_root):
os.mkdir(activity_root)
_mkdir(activity_root)
data_dir = os.path.join(activity_root, 'instance')
if not os.path.exists(data_dir):
os.mkdir(data_dir)
instance_dir = os.path.join(activity_root, 'instance')
_mkdir(instance_dir)
data_dir = os.path.join(activity_root, 'data')
if not os.path.exists(data_dir):
os.mkdir(data_dir)
_mkdir(data_dir)
tmp_dir = os.path.join(activity_root, 'tmp')
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
_mkdir(tmp_dir)
environ['SUGAR_BUNDLE_PATH'] = activity.get_path()
environ['SUGAR_BUNDLE_ID'] = activity.get_bundle_id()
@ -222,30 +227,6 @@ class ActivityCreationHandler(GObject.GObject):
self._handle.object_id, self._handle.uri,
self._handle.invited)
environment_dir = None
if os.path.exists('/etc/olpc-security') \
and os.access('/usr/bin/rainbow-run', os.X_OK):
environment_dir = tempfile.mkdtemp()
command = ['sudo', '-E', '--',
'rainbow-run',
'-v', '-v',
'-a', 'rainbow-sugarize',
'-s', '/var/spool/rainbow/2',
'-f', '1',
'-f', '2',
'-c', self._bundle.get_path(),
'-u', pwd.getpwuid(os.getuid()).pw_name,
'-i', environ['SUGAR_BUNDLE_ID'],
'-e', environment_dir,
'--',
] + command
for key, value in environ.items():
file_path = os.path.join(environment_dir, str(key))
open(file_path, 'w').write(str(value))
log_file.write(' '.join(command) + '\n\n')
dev_null = file('/dev/null', 'r')
child = subprocess.Popen([str(s) for s in command],
env=environ,
@ -257,8 +238,8 @@ class ActivityCreationHandler(GObject.GObject):
GObject.child_watch_add(child.pid,
_child_watch_cb,
(environment_dir, log_file,
self._handle.activity_id))
(log_file,
self._handle.activity_id))
def _no_reply_handler(self, *args):
pass
@ -319,11 +300,7 @@ def create_with_object_id(bundle, object_id):
def _child_watch_cb(pid, condition, user_data):
# FIXME we use standalone method here instead of ActivityCreationHandler's
# member to have workaround code, see #1123
environment_dir, log_file, activity_id = user_data
if environment_dir is not None:
subprocess.call(['/bin/rm', '-rf', environment_dir])
log_file, activity_id = user_data
if os.WIFEXITED(condition):
status = os.WEXITSTATUS(condition)

View File

@ -209,6 +209,8 @@ class Alert(Gtk.EventBox):
def __button_clicked_cb(self, button, response_id):
self._response(response_id)
if hasattr(Alert, 'set_css_name'):
Alert.set_css_name('alert')
class ConfirmationAlert(Alert):
@ -344,6 +346,8 @@ class _TimeoutIcon(Gtk.Alignment):
def set_text(self, text):
self._text.set_markup('<b>%s</b>' % GLib.markup_escape_text(str(text)))
if hasattr(_TimeoutIcon, 'set_css_name'):
_TimeoutIcon.set_css_name('timeouticon')
class _TimeoutAlert(Alert):

View File

@ -831,6 +831,8 @@ class CanvasIcon(EventIcon):
def __palette_popdown_cb(self, palette):
self.unset_state_flags(Gtk.StateFlags.PRELIGHT)
if hasattr(CanvasIcon, 'set_css_name'):
CanvasIcon.set_css_name('canvasicon')
class CellRendererIcon(Gtk.CellRenderer):

View File

@ -363,7 +363,7 @@ class _PaletteWindowWidget(Gtk.Window):
allocation = self.get_allocation()
context = self.get_style_context()
context.add_class('toolitem')
context.add_class('palette')
if gap:
cr.save()
cr.set_source_rgb(0, 0, 0)
@ -406,6 +406,8 @@ class _PaletteWindowWidget(Gtk.Window):
self.disconnect_by_func(self.__enter_notify_event_cb)
self.disconnect_by_func(self.__leave_notify_event_cb)
self.hide()
if hasattr(_PaletteWindowWidget, 'set_css_name'):
_PaletteWindowWidget.set_css_name('palette')
class MouseSpeedDetector(GObject.GObject):
@ -1196,6 +1198,7 @@ class WidgetInvoker(Invoker):
context = self.parent.get_style_context()
context.add_class('toolitem')
context.add_class('palette-down')
gap = _calculate_gap(self.get_rect(), palette.get_rect())
if gap:

View File

@ -130,6 +130,7 @@ class ToolbarButton(ToolButton):
alloc = self.get_allocation()
context = self.get_style_context()
context.add_class('toolitem')
context.add_class('toolbar-down')
if not self.is_expanded() or self.props.palette is not None and \
self.props.palette.is_up():
ToolButton.do_draw(self, cr)
@ -202,6 +203,8 @@ class ToolbarBox(Gtk.VBox):
if button == self.expanded_button:
self.remove(button.page_widget)
self._expanded_button_index = -1
if hasattr(ToolbarBox, 'set_css_name'):
ToolbarBox.set_css_name('toolbarbox')
class _ToolbarPalette(PaletteWindow):

View File

@ -323,6 +323,8 @@ class HTray(Gtk.EventBox):
def scroll_to_item(self, item):
self._viewport.scroll_to_item(item)
if hasattr(HTray, 'set_css_name'):
HTray.set_css_name('htray')
class VTray(Gtk.EventBox):
@ -414,6 +416,8 @@ class VTray(Gtk.EventBox):
def scroll_to_item(self, item):
self._viewport.scroll_to_item(item)
if hasattr(VTray, 'set_css_name'):
VTray.set_css_name('VTray')
class TrayButton(ToolButton):