Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to GTK+3 #3

Closed
wants to merge 19 commits into from
Closed

Port to GTK+3 #3

wants to merge 19 commits into from

Conversation

yell0wfl4sh
Copy link
Contributor

Everything seems to work fine except a couple of buttons in the toolbar, which I need help in.
This warning is also logged while running the activity:

(sugar-activity:25932): Gtk-WARNING **: Negative content height -13 (allocation 1, extents 7x7) while allocating gadget (node button, owner GtkToggleButton)

@quozl @chimosky please review!

@chimosky
Copy link
Member

@yashagrawal3 activity works but both play buttons doesn't have any effect, and i get this error

/home/ibiam/yash/flipsticks/montage.py:111: Warning: Source ID 12537 was not found when attempting to remove it
  GObject.source_remove(self.playing)
Traceback (most recent call last):
  File "/home/ibiam/yash/flipsticks/activity.py", line 189, in _exportframe_cb
    self.montage.exportframe()
  File "/home/ibiam/yash/flipsticks/montage.py", line 126, in exportframe
    x, y, width, height = self.mfdraw.get_allocation()
TypeError: 'Rectangle' object is not iterable
Traceback (most recent call last):
  File "/home/ibiam/yash/flipsticks/montage.py", line 321, in playframe
    self._draw_frame(self.playframenum, self.surface)
  File "/home/ibiam/yash/flipsticks/montage.py", line 802, in _draw_frame
    drawgc.set_source_rgb(white.red, white.green, white.blue)
AttributeError: '_ResultTuple' object has no attribute 'red'

@quozl
Copy link
Contributor

quozl commented Jul 13, 2018

Thanks, good progress. Will look at patches in detail once you fix those errors.

@yell0wfl4sh
Copy link
Contributor Author

I have spent a lot of time debugging TempoSlider not appearing bug still wasn't able to figure out, I am getting no errors or warning on the console, do you have some Idea where could the problem be?

@yell0wfl4sh
Copy link
Contributor Author

@chimosky @quozl Added lessons on the toolbar. Tempo Slider still doesn't show SVG image, Cartoon Builder also stopped displaying SVG image after its port to Gtk+3, so maybe it is okay to go for merge.

@quozl
Copy link
Contributor

quozl commented Aug 6, 2018

Tested on Ubuntu 16.04. Tempo slider is not shown. Snapshot button is shown in an unusual way. Angle and size sliders are not shown. See screenshots below;

2d75617

screenshot_ubuntu-xenial_2018-08-06_20 02 48

master

screenshot_ubuntu-xenial_2018-08-06_20 02 22

@chimosky
Copy link
Member

chimosky commented Aug 6, 2018

@yashagrawal3 i don't see the tempo slider.
@quozl Mine looks like this
oie_X0_Gd_Qbex_Rna_J.png

@yell0wfl4sh
Copy link
Contributor Author

@chimosky Lessons is not a new feature it is present in the master branch.
Weird that in my system it looks like this.
screenshot from 2018-08-06 16-27-02

I am using Sugar on Ubuntu 17.10 in VirtualBox.

@yell0wfl4sh
Copy link
Contributor Author

Added a commit, It now looks like this.
screenshot from 2018-08-06 16-35-27

@quozl
Copy link
Contributor

quozl commented Aug 6, 2018

Perhaps a race condition for toolbar widget rendering. What are your respective versions of python-sugar3 package? Mine is 0.112. Could you try the GTK+ Inspector? edit: ignore this

@quozl
Copy link
Contributor

quozl commented Aug 7, 2018

Tested 192e0e1 on Ubuntu 16.04. TempoSlider Gtk.HScale is rendered, but the Gtk.Image is empty.

Reviewed 192e0e1 to look for reason why widget is not rendered fully;

  • TempoSlider inherits from Gtk.HBox, which is deprecated; unlikely to be the cause of the problem, but we should really use Gtk.Box with orientation,
  • TempoSlider uses a Gtk.HScale, which is deprecated; unlikely to be the cause, but we should really use Gtk.Scale with orientation,
  • you've changed MontageToolbar and LessonsToolbar to not call the initialisation method of the parent class Gtk.Toolbar; this is not right, but I've tested and it isn't the cause, ac55406
  • there's a toolkit/activity.py being used instead of sugar3.activity, and I'm not sure why,

Non-issues as observation only,

  • TempoSlider contains a Gtk.Image and Gtk.HScale linked to a Gtk.Adjustment,
  • all child widgets have their show() methods called,
  • temposlider.py is also part of Cartoon Builder activity, is identical, and was copied from TamTam,
  • TempoSlider is used in the MontageToolbar(Gtk.Toolbar), inside a Gtk.ToolItem, and there is a call to show_all(),

Deeper debugging;

  • the pixbuf is being created with a genuine width (39 pixels), but is not rendering,
  • the Rsvg.Handle and new_from_data usage is unique; no other activity uses this precise wording, looks to have been inherited from sugarlabs/cartoon-builder@917c20d by @zeecoder606, which I had tested on an older version of GTK+ and Rsvg.

Fixed in 2d030fd by calling Rsvg.Handle differently.

Pushed. @chimosky, please test.

@quozl
Copy link
Contributor

quozl commented Aug 7, 2018

@yashagrawal3 said

Cartoon Builder also stopped displaying SVG image after its port to Gtk+3, so maybe it is okay to go for merge.

Should be fixed in Cartoon Builder now; sugarlabs/cartoon-builder@6a52371

@chimosky
Copy link
Member

chimosky commented Aug 7, 2018

@quozl tested, works fine but when screen-shot button is clicked i get this error

 Traceback (most recent call last):
  File "/home/ibiam/yash/flipsticks/activity.py", line 183, in _exportframe_cb
    self.montage.exportframe()
  File "/home/ibiam/yash/flipsticks/montage.py", line 126, in exportframe
    width = widget.get_allocated_width()
NameError: global name 'widget' is not defined

@quozl
Copy link
Contributor

quozl commented Aug 7, 2018

Yes, an obvious cause, will you be fixing it? See the change.

@chimosky
Copy link
Member

chimosky commented Aug 7, 2018

Fixed in #1

@quozl
Copy link
Contributor

quozl commented Aug 7, 2018

Thanks.

  • should it be self.mfdraw instead of self.window, given that self.mfdraw is the surface being used to make the screenshot?
  • as I did, you could also push to the branch associated with this pull request; the gtk3 branch of yashagrawal3/flipsticks? Or is something stopping that from working?

@chimosky
Copy link
Member

chimosky commented Aug 7, 2018

  • should it be self.mfdraw instead of self.window, given that self.mfdraw is the surface being used to make the screenshot?

self.window gave me a screen-shot once, self.mfdraw hasn't given me any

  • as I did, you could also push to the branch associated with this pull request; the gtk3 branch of yashagrawal3/flipsticks? Or is something stopping that from working?

That's what i did.

@quozl
Copy link
Contributor

quozl commented Aug 7, 2018

Okay, thanks. Interesting. I've never seen a new pull request created when I did a git push yashagrawal3 gtk3:gtk3. Your account must be special in some way.

@yell0wfl4sh
Copy link
Contributor Author

Thanks, tested and merged @chimosky 's pull request.

@quozl
Copy link
Contributor

quozl commented Aug 8, 2018

Tested on Ubuntu 16.02 with Sugar 0.112 and GTK+ 3.18.9. Comparing master branch to gtk3 branch 3046cab;

  • the play forward and play backward icons are different sizes,
  • the angle and size sliders are not shown properly,
  • the lines are much thicker in the figures drawn in the circles at the bottom of display,
  • when playing the animation, the figure is drawn white on black, instead of black on white,
  • the snapshot button (it's never been a screenshot button) does nothing; there is no journal entry created, and logs show "AttributeError: 'View' object has no attribute 'window', on line 126, in exportframe; it does not seem like 3046cab was tested properly.

screenshot_ubuntu-xenial_2018-08-08_09 55 07

I tried this;

-        width = self.window.get_width()
-        height = self.window.get_height()
+        width = self.mfdraw.get_allocated_width()
+        height = self.mfdraw.get_allocated_height()

and got this;

Traceback (most recent call last):
  File "/usr/share/sugar/activities/FlipSticks.activity/activity.py", line 183, in _exportframe_cb
    self.montage.exportframe()
  File "/usr/share/sugar/activities/FlipSticks.activity/montage.py", line 128, in exportframe
    surface = self.mfdraw.get_window().create_similar_surface(Gdk.Content.ColorAlpha, width, height)
  File "/usr/lib/python2.7/dist-packages/gi/overrides/__init__.py", line 39, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 139, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Gdk' object has no attribute 'Content'

Looks like there is lots more to do here.

@chimosky
Copy link
Member

chimosky commented Aug 8, 2018

@quozl further testing showed errors, looking into it.

@quozl
Copy link
Contributor

quozl commented Aug 13, 2018

Thanks. Reviewed.

7f93690 makes a change unrelated to the commit message; not sure if you intended that, as it reverts 3046cab.

@quozl quozl added this to To do in Port to GTK 3 Aug 28, 2019
@quozl quozl moved this from To do to In progress in Port to GTK 3 Aug 28, 2019
@Saumya-Mishra9129
Copy link
Member

We can close this now.

@quozl quozl closed this Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Port to GTK 3
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants