Permalink
Browse files

Merge upstream MyPaint up to current master (93e37d8)

Conflicts:
	gui/resources.xml
	lib/document.py
  • Loading branch information...
2 parents e58c002 + 93e37d8 commit 6933d9ecd766e14f8c395f6b6011b68a0c5a5f4a @davissorenson davissorenson committed Oct 3, 2013
Showing with 3,070 additions and 901 deletions.
  1. BIN desktop/icons/hicolor/16x16/actions/mypaint-tool-flood-fill.png
  2. BIN desktop/icons/hicolor/16x16/apps/mypaint.png
  3. BIN desktop/icons/hicolor/22x22/actions/mypaint-tool-flood-fill.png
  4. BIN desktop/icons/hicolor/22x22/apps/mypaint.png
  5. BIN desktop/icons/hicolor/24x24/actions/mypaint-tool-flood-fill.png
  6. BIN desktop/icons/hicolor/24x24/apps/mypaint.png
  7. BIN desktop/icons/hicolor/256x256/mypaint.png
  8. BIN desktop/icons/hicolor/32x32/actions/mypaint-tool-flood-fill.png
  9. BIN desktop/icons/hicolor/32x32/apps/mypaint.png
  10. BIN desktop/icons/hicolor/48x48/actions/mypaint-tool-flood-fill.png
  11. BIN desktop/icons/hicolor/48x48/apps/mypaint.png
  12. BIN desktop/icons/hicolor/512x512/apps/mypaint.png
  13. +698 −0 desktop/icons/hicolor/scalable/actions/mypaint-tool-flood-fill.svg
  14. +0 −433 desktop/icons/hicolor/scalable/apps/mypaint.svg
  15. BIN desktop/mypaint.ico
  16. +36 −11 gui/application.py
  17. +16 −9 gui/brusheditor.py
  18. +9 −8 gui/brushiconeditor.py
  19. +2 −3 gui/buttonmap.py
  20. +450 −86 gui/canvasevent.py
  21. +3 −11 gui/colorpicker.py
  22. +9 −2 gui/drawwindow.py
  23. +256 −0 gui/fill.py
  24. +124 −85 gui/framewindow.py
  25. +119 −24 gui/linemode.py
  26. +6 −0 gui/menu.xml
  27. +115 −0 gui/optionspanel.py
  28. +38 −0 gui/resources.xml
  29. +2 −33 gui/toolbar.py
  30. +1 −0 gui/toolbar.xml
  31. +6 −15 gui/workspace.py
  32. +131 −0 lib/command.py
  33. +134 −22 lib/document.py
  34. +355 −0 lib/fill.hpp
  35. +12 −8 lib/fix15.hpp
  36. +2 −1 lib/helpers.py
  37. +13 −30 lib/idletask.py
  38. +84 −12 lib/layer.py
  39. +1 −0 lib/mypaintlib.hpp
  40. +1 −0 lib/mypaintlib.i
  41. +2 −1 lib/pixbufsurface.py
  42. +85 −41 lib/strokemap.py
  43. +7 −5 lib/tiledsurface.hpp
  44. +352 −60 lib/tiledsurface.py
  45. BIN pixmaps/mypaint_logo.png
  46. BIN svg/mypaint-tool-flood-fill.svgz
  47. +1 −1 tests/test_mypaintlib.py
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
View
Binary file not shown.
View
@@ -22,6 +22,7 @@
from lib import brush
from lib import helpers
from lib import mypaintlib
+from brushlib import brushsettings
def get_app():
@@ -47,6 +48,7 @@ def get_app():
import layerswindow
import animationwindow
import previewwindow
+import optionspanel
import framewindow
import scratchwindow
import inputtestwindow
@@ -57,6 +59,7 @@ def get_app():
import linemode
import colors
import colorpreview
+import fill
from brushcolor import BrushColorManager
from overlays import LastPaintPosOverlay
from overlays import ScaleOverlay
@@ -237,6 +240,9 @@ def __init__(self, filenames, app_datapath, app_extradatapath,
self.brush_color_manager.set_picker_cursor(self.cursor_color_picker)
self.brush_color_manager.set_data_path(self.datapath)
+ #: Mapping of setting cname to a GtkAdjustment which controls the base
+ #: value of that setting for the app's current brush.
+ self.brush_adjustment = {}
self.init_brush_adjustments()
# Connect signals defined in mypaint.xml
@@ -273,7 +279,6 @@ def __init__(self, filenames, app_datapath, app_extradatapath,
"BackgroundWindow": backgroundwindow.BackgroundWindow,
"BrushEditorWindow": brusheditor.BrushEditorWindow,
"PreferencesWindow": preferenceswindow.PreferencesWindow,
- "FrameEditWindow": framewindow.FrameEditWindow,
"InputTestWindow": inputtestwindow.InputTestWindow,
"BrushIconEditorWindow": brushiconeditor.BrushIconEditorWindow,
}
@@ -452,15 +457,40 @@ def find_action(self, name):
if result is not None:
return result
+
+ ## Brush settings: GtkAdjustments for base values
+
def init_brush_adjustments(self):
- """Initializes all the brush adjustments for the current brush"""
- self.brush_adjustment = {}
- from brushlib import brushsettings
- for i, s in enumerate(brushsettings.settings_visible):
- adj = gtk.Adjustment(value=s.default, lower=s.min, upper=s.max, step_incr=0.01, page_incr=0.1)
+ """Initializes the base value adjustments for all brush settings"""
+ assert not self.brush_adjustment
+ changed_cb = self._brush_adjustment_value_changed_cb
+ for s in brushsettings.settings_visible:
+ adj = gtk.Adjustment(value=s.default, lower=s.min, upper=s.max,
+ step_incr=0.01, page_incr=0.1)
self.brush_adjustment[s.cname] = adj
+ adj.connect("value-changed", changed_cb, s.cname)
+ self.brush.observers.append(self._brush_modified_cb)
+
+
+ def _brush_adjustment_value_changed_cb(self, adj, cname):
+ """Updates a brush setting when the user tweaks it using a scale"""
+ newvalue = adj.get_value()
+ if self.brush.get_base_value(cname) != newvalue:
+ self.brush.set_base_value(cname, newvalue)
+ def _brush_modified_cb(self, settings):
+ """Updates the brush's base setting adjustments on brush changes"""
+ for cname in settings:
+ adj = self.brush_adjustment.get(cname, None)
+ if adj is None:
+ continue
+ value = self.brush.get_base_value(cname)
+ adj.set_value(value)
+
+
+ ## Button mappings, global pressure curve, input devices...
+
def update_button_mapping(self):
self.button_mapping.update(self.preferences["input.button_mapping"])
@@ -698,11 +728,6 @@ def preferences_window(self):
@property
- def frame_edit_window(self):
- """The frame editor subwindow."""
- return self.get_subwindow("FrameEditWindow")
-
- @property
def input_test_window(self):
"""The input test window."""
return self.get_subwindow("InputTestWindow")
View
@@ -103,15 +103,16 @@ def _init_adjustments(self):
for s in brushsettings.settings_visible:
adj = self.app.brush_adjustment[s.cname]
self._base_adj[s.cname] = adj
+ # The application instance manages value-changed callbacks itself.
else:
for s in brushsettings.settings_visible:
adj = Gtk.Adjustment(value=s.default,
lower=s.min, upper=s.max,
step_incr=0.01, page_incr=0.1)
self._base_adj[s.cname] = adj
- for cname, adj in self._base_adj.iteritems():
- adj.connect('value-changed', self.base_value_adj_changed_cb,
- cname)
+ changed_cb = self._testmode_base_value_adj_changed_cb
+ for cname, adj in self._base_adj.iteritems():
+ adj.connect('value-changed', changed_cb, cname)
# Per-input scale maxima and minima
for inp in brushsettings.inputs:
name = inp.name
@@ -595,14 +596,19 @@ def brush_modified_cb(self, settings, expanders=False):
def _update_setting_ui(self, expanders=False):
"""Updates all the UI elements for the current setting"""
- # Update base value slider
+ # Update base value adjuster and slider
if self._setting is None:
return
- scale = self._builder.get_object("base_value_scale")
base_adj = self._base_adj[self._setting.cname]
+ # Update its value if running in test mode
+ # Normally the app will do this itself
+ if not self.app:
+ newvalue = self._brush.get_base_value(self._setting.cname)
+ base_adj.set_value(newvalue)
+ # Associate the base value scale with the right adjustment
+ scale = self._builder.get_object("base_value_scale")
if scale.get_adjustment() is not base_adj:
scale.set_adjustment(base_adj)
- base_adj.set_value(self._brush.get_base_value(self._setting.cname))
# Update brush dynamics curves and sliders
for inp in brushsettings.inputs:
# check whether we really need to update anything
@@ -767,8 +773,9 @@ def _current_setting_changed(self):
## Adjuster change callbacks
- def base_value_adj_changed_cb(self, adj, cname):
- """User adjusted the setting's base value using the scale"""
+ def _testmode_base_value_adj_changed_cb(self, adj, cname):
+ """User adjusted the setting's base value using the scale (test only)
+ """
value = adj.get_value()
self._brush.set_base_value(cname, value)
@@ -936,7 +943,7 @@ def _test():
win.connect("delete-event", lambda *a: Gtk.main_quit())
win.show_all()
Gtk.main()
-
+
if __name__ == '__main__':
@@ -146,6 +146,7 @@ def _init_widgets(self):
button_box = Gtk.VButtonBox()
button_box.set_homogeneous(False)
button_box.set_layout(Gtk.ButtonBoxStyle.START)
+ button_box.set_spacing(4)
# TRANSLATORS: begin editing a brush's preview icon
b = self._make_image_button(_('Edit'), Gtk.STOCK_EDIT,
@@ -154,6 +155,14 @@ def _init_widgets(self):
button_box.pack_start(b, expand=False)
self._edit_button = b
+ # TRANSLATORS: revert edits to a brush icon
+ b = self._make_image_button(_('Revert'), Gtk.STOCK_REVERT_TO_SAVED,
+ self._revert_cb)
+ b.set_tooltip_text(_("Discard changes, and cancel editing"))
+ button_box.pack_start(b, expand=False)
+ button_box.set_child_secondary(b, False)
+ self._revert_button = b
+
# TRANSLATORS: clear the brush preview icon being edited
b = self._make_image_button(_('Clear'), Gtk.STOCK_CLEAR,
self._clear_cb)
@@ -165,14 +174,6 @@ def _init_widgets(self):
#lbl.set_line_wrap(Pango.WrapMode.WORD_CHAR)
#button_box.pack_start(lbl, expand=False)
- # TRANSLATORS: revert edits to a brush icon
- b = self._make_image_button(_('Revert'), Gtk.STOCK_REVERT_TO_SAVED,
- self._revert_cb)
- b.set_tooltip_text(_("Discard changes, and cancel editing"))
- button_box.pack_start(b, expand=False)
- button_box.set_child_secondary(b, True)
- self._revert_button = b
-
# TRANSLATORS: save edits to a brush icon
b = self._make_image_button(_('Save'), Gtk.STOCK_SAVE,
self._save_cb)
View
@@ -292,9 +292,8 @@ def __init__(self):
list_tools = gtk.Toolbar()
list_tools.set_style(gtk.TOOLBAR_ICONS)
list_tools.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
- if False: # TODO: GTK3
- context = list_tools.get_style_context()
- context.add_class("inline-toolbar")
+ context = list_tools.get_style_context()
+ context.add_class("inline-toolbar")
self.vbox.pack_start(list_tools, False, False)
# Add binding
Oops, something went wrong.

0 comments on commit 6933d9e

Please sign in to comment.