pep8'd sugar3.activity
This commit is contained in:
parent
3e5c37f3f8
commit
8a6c935dd0
@ -875,7 +875,8 @@ class Activity(Window, Gtk.Container):
|
|||||||
alert.props.msg = _('Keep error: all changes will be lost')
|
alert.props.msg = _('Keep error: all changes will be lost')
|
||||||
|
|
||||||
cancel_icon = Icon(icon_name='dialog-cancel')
|
cancel_icon = Icon(icon_name='dialog-cancel')
|
||||||
alert.add_button(Gtk.ResponseType.CANCEL, _('Don\'t stop'), cancel_icon)
|
alert.add_button(Gtk.ResponseType.CANCEL, _('Don\'t stop'),
|
||||||
|
cancel_icon)
|
||||||
|
|
||||||
stop_icon = Icon(icon_name='dialog-ok')
|
stop_icon = Icon(icon_name='dialog-ok')
|
||||||
alert.add_button(Gtk.ResponseType.OK, _('Stop anyway'), stop_icon)
|
alert.add_button(Gtk.ResponseType.OK, _('Stop anyway'), stop_icon)
|
||||||
|
@ -200,10 +200,12 @@ class ActivityCreationHandler(GObject.GObject):
|
|||||||
self._launch_activity()
|
self._launch_activity()
|
||||||
|
|
||||||
def _launch_activity(self):
|
def _launch_activity(self):
|
||||||
if self._handle.activity_id != None:
|
if self._handle.activity_id is not None:
|
||||||
self._shell.ActivateActivity(self._handle.activity_id,
|
self._shell.ActivateActivity(self._handle.activity_id,
|
||||||
reply_handler=self._activate_reply_handler,
|
reply_handler=
|
||||||
error_handler=self._activate_error_handler)
|
self._activate_reply_handler,
|
||||||
|
error_handler=
|
||||||
|
self._activate_error_handler)
|
||||||
else:
|
else:
|
||||||
self._create_activity()
|
self._create_activity()
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class Packager(object):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
cwd=self.config.source_dir)
|
cwd=self.config.source_dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
logging.warn('Packager: git is not installed, ' \
|
logging.warn('Packager: git is not installed, '
|
||||||
'fall back to filtered list')
|
'fall back to filtered list')
|
||||||
return list_files(self.config.source_dir,
|
return list_files(self.config.source_dir,
|
||||||
IGNORE_DIRS, IGNORE_FILES)
|
IGNORE_DIRS, IGNORE_FILES)
|
||||||
@ -168,7 +168,7 @@ class Packager(object):
|
|||||||
stdout, _ = git_ls.communicate()
|
stdout, _ = git_ls.communicate()
|
||||||
if git_ls.returncode:
|
if git_ls.returncode:
|
||||||
# Fall back to filtered list
|
# Fall back to filtered list
|
||||||
logging.warn('Packager: this is not a git repository, ' \
|
logging.warn('Packager: this is not a git repository, '
|
||||||
'fall back to filtered list')
|
'fall back to filtered list')
|
||||||
return list_files(self.config.source_dir,
|
return list_files(self.config.source_dir,
|
||||||
IGNORE_DIRS, IGNORE_FILES)
|
IGNORE_DIRS, IGNORE_FILES)
|
||||||
|
@ -53,7 +53,7 @@ def _extract_header(file_path):
|
|||||||
|
|
||||||
version_, num_of_strings = _read_bin(handle, format_string, 8)
|
version_, num_of_strings = _read_bin(handle, format_string, 8)
|
||||||
|
|
||||||
msgids_hash_offset, msgstrs_hash_offset = _read_bin(handle, \
|
msgids_hash_offset, msgstrs_hash_offset = _read_bin(handle,
|
||||||
format_string, 8)
|
format_string, 8)
|
||||||
handle.seek(msgids_hash_offset)
|
handle.seek(msgids_hash_offset)
|
||||||
|
|
||||||
@ -142,8 +142,8 @@ def get_locale_path(bundle_id):
|
|||||||
|
|
||||||
for candidate_dir in candidate_dirs.keys():
|
for candidate_dir in candidate_dirs.keys():
|
||||||
if os.path.exists(candidate_dir):
|
if os.path.exists(candidate_dir):
|
||||||
full_path = os.path.join(candidate_dir, \
|
full_path = os.path.join(candidate_dir,
|
||||||
default_locale, 'LC_MESSAGES', \
|
default_locale, 'LC_MESSAGES',
|
||||||
bundle_id + '.mo')
|
bundle_id + '.mo')
|
||||||
if os.path.exists(full_path):
|
if os.path.exists(full_path):
|
||||||
try:
|
try:
|
||||||
@ -154,7 +154,7 @@ def get_locale_path(bundle_id):
|
|||||||
# Set lowest priority
|
# Set lowest priority
|
||||||
candidate_dirs[candidate_dir] = -1
|
candidate_dirs[candidate_dir] = -1
|
||||||
|
|
||||||
available_paths = sorted(candidate_dirs.iteritems(), key=lambda (k, v): \
|
available_paths = sorted(candidate_dirs.iteritems(), key=lambda (k, v):
|
||||||
(v, k), reverse=True)
|
(v, k), reverse=True)
|
||||||
preferred_path = available_paths[0][0]
|
preferred_path = available_paths[0][0]
|
||||||
return preferred_path
|
return preferred_path
|
||||||
|
@ -175,7 +175,8 @@ class TitleEntry(Gtk.ToolItem):
|
|||||||
self.entry = Gtk.Entry(**kwargs)
|
self.entry = Gtk.Entry(**kwargs)
|
||||||
self.entry.set_size_request(int(Gdk.Screen.width() / 3), -1)
|
self.entry.set_size_request(int(Gdk.Screen.width() / 3), -1)
|
||||||
self.entry.set_text(activity.metadata['title'])
|
self.entry.set_text(activity.metadata['title'])
|
||||||
self.entry.connect('focus-out-event', self.__title_changed_cb, activity)
|
self.entry.connect(
|
||||||
|
'focus-out-event', self.__title_changed_cb, activity)
|
||||||
self.entry.connect('button-press-event', self.__button_press_event_cb)
|
self.entry.connect('button-press-event', self.__button_press_event_cb)
|
||||||
self.entry.show()
|
self.entry.show()
|
||||||
self.add(self.entry)
|
self.add(self.entry)
|
||||||
@ -322,7 +323,7 @@ class ActivityToolbar(Gtk.Toolbar):
|
|||||||
self.insert(title_button, -1)
|
self.insert(title_button, -1)
|
||||||
self.title = title_button.entry
|
self.title = title_button.entry
|
||||||
|
|
||||||
if orientation_left == False:
|
if not orientation_left:
|
||||||
separator = Gtk.SeparatorToolItem()
|
separator = Gtk.SeparatorToolItem()
|
||||||
separator.props.draw = False
|
separator.props.draw = False
|
||||||
separator.set_expand(True)
|
separator.set_expand(True)
|
||||||
|
Loading…
Reference in New Issue
Block a user