Closed Hrishi1999 closed 7 years ago
I need help for example. How do you exactly want it?
There's a section about your question in the guide to contributing be sure to read it in full.
Also, on IRC a couple of hours ago the problem you had was caused by your previous use of the master
branch, and the suggestion from nemesiscodex
was valid but depends critically on careful execution and having the repository set to your topic branch to begin with.
Here's what they said;
<nemesiscodex> ok, now I get your problem hrishi1999,
your master branch already have those commits
<nemesiscodex> what I usually do is to add the upstream repository,
and then rebase to the master branch of that repository
<nemesiscodex> to add the upstream:
<nemesiscodex> git remote add upstream https://github.com/sugarlabs/sugar-toolkit-gtk3.git
<nemesiscodex> then update all my pointers
<nemesiscodex> git fetch --all
<nemesiscodex> then rebase to the upstream master branch:
<nemesiscodex> git rebase -i upstream/master
<nemesiscodex> squash everything and push the branch
<nemesiscodex> and if you want to make sure everything looks good, try this command:
<nemesiscodex> git diff upstream/master..HEAD
From these three sources (guide to contributing, my comments here, IRC quote above) you will need to deduce and test the actions required.
I will of course try this, didn't have time when he posted this.
I am having issues. It says there are conflicts with it.
@quozl tried what nemesiscodex said, nothing changed.
Not practical for me to guess what is wrong. Show me a log. In text, not as an image. Use screen(1) command or copy and paste. If using GitHub comment in markdown format, use three backtick marks to quote.
Also, never move past a step unless it is successful and without error.
@quozl can you please help me on IRC, it will be much faster
Here is how your rebase conflicts were reproduced and then resolved, using a local clone in /tmp directory.
$ git clone https://github.com/sugarlabs/sugar-toolkit-gtk3
Cloning into 'sugar-toolkit-gtk3'...
done.
$ cd sugar-toolkit-gtk3/
$ git remote add hrishi https://github.com/Hrishi1999/sugar-toolkit-gtk3
$ git fetch hrishi
From https://github.com/Hrishi1999/sugar-toolkit-gtk3
* [new branch] toggletoolbutton -> hrishi/toggletoolbutton
Problem: your master branch is ahead of upstream because you began work on it instead of using a topic branch. While you have since moved to a topic branch for work, the master branch remained damaged.
Verification: git log
shows two patches ahead of the most recent upstream patch 53c5058da08c11f167087a34d7dc7344d2b86098.
Solution: use git reset --hard
to repoint HEAD to where it was before, thus disconnecting your changes (2a4cd62bbb768063309eeffcf72d35a4d13ef0a4, acad72d741870fbe3cd29498132fa8be96b85b55) from HEAD.
$ git checkout -b the-master hrishi/master
Branch the-master set up to track remote branch master from hrishi by rebasing.
Switched to a new branch 'the-master'
$ git log -3
commit 2a4cd62bbb768063309eeffcf72d35a4d13ef0a4
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:38:23 2016 +0530
Update toggletoolbutton.py
commit acad72d741870fbe3cd29498132fa8be96b85b55
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:37:54 2016 +0530
Create toggletoolbutton.py
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
$ git reset --hard 53c5058da08c11f167087a34d7dc7344d2b86098
HEAD is now at 53c5058 Merge pull request #349 from quozl/2016-347-toolbutton
$ git log -1
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
Problem: your topic branch has too many commits, because as you made changes you did not use --amend
, but instead made a new commit for each change.
Solution: use git rebase -i
... which made conflicts, see below;
$ git checkout -b the-topic hrishi/toggletoolbutton
Branch the-topic set up to track remote branch toggletoolbutton from hrishi by rebasing.
Switched to a new branch 'the-topic'
$ git log -8
commit 1edd2631f4fd9372ac10d297bd265c2d6e2287d7
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 22:24:31 2016 +0530
Update toggletoolbutton.py
commit 2e927a307f3da9a57b0368b7454a2c5572e5819a
Merge: 23d0262 99fdcd9
Author: Hrishi1999 <hrishipatel_5@outlook.com>
Date: Thu Dec 29 22:07:42 2016 +0530
Merge branch 'toggletoolbutton' of sugar-toolkit-gtk3 into toggletoolbutton
commit 23d026237ed30981973f03c04b4baf737929330d
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:37:54 2016 +0530
Create toggletoolbutton.py
Update toggletoolbutton.py
commit 99fdcd9f7880bc134adba11e4e68eb47bd8bd43f
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 15:01:01 2016 +0530
Update toggletoolbutton.py
commit 73897eed50538137148d9aab9810db5a0fbccd22
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 14:48:46 2016 +0530
Update toggletoolbutton.py
commit 4ac6911d71bedc75a9481f1fbd25d0cad671fe21
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:38:23 2016 +0530
Update toggletoolbutton.py
commit acad72d741870fbe3cd29498132fa8be96b85b55
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:37:54 2016 +0530
Create toggletoolbutton.py
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
$ git rebase -i 53c5058da08c11f167087a34d7dc7344d2b86098
Waiting for Emacs...
pick 23d0262 Create toggletoolbutton.py
squash acad72d Create toggletoolbutton.py
squash 4ac6911 Update toggletoolbutton.py
squash 73897ee Update toggletoolbutton.py
squash 99fdcd9 Update toggletoolbutton.py
squash 1edd263 Update toggletoolbutton.py
error: could not apply acad72d... Create toggletoolbutton.py
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply acad72d741870fbe3cd29498132fa8be96b85b55... Create toggletoolbutton.py
$ git status
rebase in progress; onto 53c5058
You are currently rebasing branch 'the-topic' on '53c5058'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both added: examples/toggletoolbutton.py
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --cc examples/toggletoolbutton.py
index 679241f,03deadc..0000000
--- a/examples/toggletoolbutton.py
+++ b/examples/toggletoolbutton.py
@@@ -17,6 -17,10 +17,13 @@@ toolbar_box = ToolbarBox(
vbox.pack_start(toolbar_box, False, False, 0)
toolbar_box.show()
++<<<<<<< HEAD
++=======
+ separator = Gtk.SeparatorToolItem()
+ toolbar_box.toolbar.insert(separator, -1)
+ separator.show()
+
++>>>>>>> acad72d... Create toggletoolbutton.py
favorite_button = ToggleToolButton('emblem-favorite')
favorite_button.set_tooltip('Favorite')
toolbar_box.toolbar.insert(favorite_button, -1)
$ git checkout 1edd263 -- examples/toggletoolbutton.py # overwrite with latest
$ git diff
$ git add examples/toggletoolbutton.py
$ git rebase --continue
error: could not apply 4ac6911... Update toggletoolbutton.py
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 4ac6911d71bedc75a9481f1fbd25d0cad671fe21... Update toggletoolbutton.py
$ git status
rebase in progress; onto 53c5058
You are currently rebasing branch 'the-topic' on '53c5058'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: src/sugar3/graphics/toggletoolbutton.py
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --cc src/sugar3/graphics/toggletoolbutton.py
index 48d5386,24fc273..0000000
--- a/src/sugar3/graphics/toggletoolbutton.py
+++ b/src/sugar3/graphics/toggletoolbutton.py
@@@ -64,11 -64,13 +64,21 @@@ class ToggleToolButton(Gtk.ToggleToolBu
having an icon, a tooltip palette, and an accelerator.
Use ToggleToolButton.new() to create a new ToggleToolButton.
++<<<<<<< HEAD
+ Args:
+ accelerator (string): keyboard shortcut to be used to
+ activate this button.
+ Find about format here : goo.gl/JrEMWP
+
++=======
+ Fuctions:
+ ToggleToolButton()
+ Returns: a new toggletoolbutton
+
+ Args:
+ accelerator (string): keyboard shortcut to be used to
+ activate this button.
++>>>>>>> 4ac6911... Update toggletoolbutton.py
tooltip (string): tooltip to be displayed when user
hovers over toggle button.
@@@ -160,8 -162,6 +170,11 @@@
Args:
accelerator(string): accelerator to be set. Should be in
form <modifier>Letter
++<<<<<<< HEAD
+ Find about format here : goo.gl/JrEMWP
+
++=======
++>>>>>>> 4ac6911... Update toggletoolbutton.py
Example:
set_accelerator(self, 'accel')
$ git rebase --abort # give up
$ git log -1 # verify back to normal
commit 1edd2631f4fd9372ac10d297bd265c2d6e2287d7
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 22:24:31 2016 +0530
Update toggletoolbutton.py
Solution: use git reset --soft
to repoint HEAD, leaving the workspace intact, then commit again.
$ git log -8 # verify state of HEAD
commit 1edd2631f4fd9372ac10d297bd265c2d6e2287d7
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 22:24:31 2016 +0530
Update toggletoolbutton.py
commit 2e927a307f3da9a57b0368b7454a2c5572e5819a
Merge: 23d0262 99fdcd9
Author: Hrishi1999 <hrishipatel_5@outlook.com>
Date: Thu Dec 29 22:07:42 2016 +0530
Merge branch 'toggletoolbutton' of sugar-toolkit-gtk3 into toggletoolbutton
commit 23d026237ed30981973f03c04b4baf737929330d
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:37:54 2016 +0530
Create toggletoolbutton.py
Update toggletoolbutton.py
commit 99fdcd9f7880bc134adba11e4e68eb47bd8bd43f
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 15:01:01 2016 +0530
Update toggletoolbutton.py
commit 73897eed50538137148d9aab9810db5a0fbccd22
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 14:48:46 2016 +0530
Update toggletoolbutton.py
commit 4ac6911d71bedc75a9481f1fbd25d0cad671fe21
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:38:23 2016 +0530
Update toggletoolbutton.py
commit acad72d741870fbe3cd29498132fa8be96b85b55
Author: Hrishi <hrishipatel99@gmail.com>
Date: Thu Dec 29 13:37:54 2016 +0530
Create toggletoolbutton.py
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
$ git reset --soft 53c5058da08c11f167087a34d7dc7344d2b86098
$ git log -1
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
$ git status
On branch the-topic
Your branch is behind 'hrishi/toggletoolbutton' by 7 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: examples/toggletoolbutton.py
modified: src/sugar3/graphics/toggletoolbutton.py
$ git commit -m 'Squashed' # you should write a full commit message here
[the-topic 7573bce] Squashed
2 files changed, 89 insertions(+)
create mode 100644 examples/toggletoolbutton.py
$ git format-patch -1
0001-Squashed.patch
$ cat 0001-Squashed.patch
From 7573bced7728fb1063ba1d82252b11fecbcd65e4 Mon Sep 17 00:00:00 2001
From: James Cameron <quozl@laptop.org>
Date: Fri, 30 Dec 2016 18:44:58 +1100
Subject: [PATCH] Squashed
---
examples/toggletoolbutton.py | 27 ++++++++++++++
src/sugar3/graphics/toggletoolbutton.py | 62 +++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
create mode 100644 examples/toggletoolbutton.py
diff --git a/examples/toggletoolbutton.py b/examples/toggletoolbutton.py
new file mode 100644
index 0000000..679241f
--- /dev/null
+++ b/examples/toggletoolbutton.py
@@ -0,0 +1,27 @@
+from gi.repository import Gtk
+
+from sugar3.graphics.toolbarbox import ToolbarBox
+from sugar3.graphics.toggletoolbutton import ToggleToolButton
+
+import common
+
+
+test = common.Test()
+test.show()
+
+vbox = Gtk.VBox()
+test.pack_start(vbox, True, True, 0)
+vbox.show()
+
+toolbar_box = ToolbarBox()
+vbox.pack_start(toolbar_box, False, False, 0)
+toolbar_box.show()
+
+favorite_button = ToggleToolButton('emblem-favorite')
+favorite_button.set_tooltip('Favorite')
+toolbar_box.toolbar.insert(favorite_button, -1)
+favorite_button.show()
+
+
+if __name__ == '__main__':
+ common.main(test)
diff --git a/src/sugar3/graphics/toggletoolbutton.py b/src/sugar3/graphics/toggletoolbutton.py
index 76f0f94..fa0cf26 100644
--- a/src/sugar3/graphics/toggletoolbutton.py
+++ b/src/sugar3/graphics/toggletoolbutton.py
@@ -58,6 +58,24 @@ def setup_accelerator(tool_button):
class ToggleToolButton(Gtk.ToggleToolButton):
+ '''
+ UI for toggletoolbutton.
+ A ToggleToolButton is a ToolItem that contains a toggle button,
+ having an icon, a tooltip palette, and an accelerator.
+ Use ToggleToolButton.new() to create a new ToggleToolButton.
+
+ Args:
+ accelerator (string): keyboard shortcut to be used to
+ activate this button.
+ Find about format here :
+ https://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accelerator-parse
+
+ tooltip (string): tooltip to be displayed when user
+ hovers over toggle button.
+
+ Keyword Args:
+ icon_name(string): name of themed icon which is to be used.
+ '''
__gtype_name__ = 'SugarToggleToolButton'
@@ -76,11 +94,26 @@ class ToggleToolButton(Gtk.ToggleToolButton):
self._palette_invoker.detach()
def set_icon_name(self, icon_name):
+ '''
+ Sets the icon for the tool button from a named themed icon.
+ If it is none then no icon will be shown.
+
+ Args:
+ icon_name(string): The name for a themed icon.
+ It can be set as 'None' too.
+
+ Example:
+ set_icon_name('view-radial')
+ '''
icon = Icon(icon_name=icon_name)
self.set_icon_widget(icon)
icon.show()
def get_icon_name(self):
+ '''
+ The get_icon_name() method returns the value of the icon_name
+ property that contains the name of a themed icon or None.
+ '''
if self.props.icon_widget is not None:
return self.props.icon_widget.props.icon_name
else:
@@ -112,19 +145,44 @@ class ToggleToolButton(Gtk.ToggleToolButton):
type=object, setter=set_palette_invoker, getter=get_palette_invoker)
def set_tooltip(self, text):
+ '''
+ Sets the tooltip of the toogle tool button. Displays when
+ user hovers over the button with cursor.
+
+ Args:
+ tooltip (string): tooltip to be added to the button
+ '''
self.set_palette(Palette(text))
def set_accelerator(self, accelerator):
+ '''
+ Sets keyboard shortcut that activates this button.
+
+ Args:
+ accelerator(string): accelerator to be set. Should be in
+ form <modifier>Letter
+ Find about format here :
+ https://developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accelerator-parse
+
+ Example:
+ set_accelerator(self, 'accel')
+ '''
self._accelerator = accelerator
setup_accelerator(self)
def get_accelerator(self):
+ '''
+ Returns above accelerator string.
+ '''
return self._accelerator
accelerator = GObject.property(type=str, setter=set_accelerator,
getter=get_accelerator)
def do_draw(self, cr):
+ '''
+ Implementation method for drawing the toogle tool button
+ '''
if self.palette and self.palette.is_up():
allocation = self.get_allocation()
# draw a black background, has been done by the engine before
@@ -141,6 +199,10 @@ class ToggleToolButton(Gtk.ToggleToolButton):
return False
def do_clicked(self):
+ '''
+ Implementation method for hiding the tooltip when the
+ toggle button is clicked
+ '''
if self.palette:
self.palette.popdown(True)
--
1.9.1
$ git reflog -9
7573bce HEAD@{0}: commit: Squashed
53c5058 HEAD@{1}: reset: moving to 53c5058da08c11f167087a34d7dc7344d2b86098
1edd263 HEAD@{2}: rebase: aborting
0ca00d2 HEAD@{3}: rebase -i (pick): Create toggletoolbutton.py
53c5058 HEAD@{4}: rebase -i (start): checkout 53c5058da08c11f167087a34d7dc7344d2
1edd263 HEAD@{5}: rebase: aborting
1b69e88 HEAD@{6}: rebase -i (pick): Create toggletoolbutton.py
53c5058 HEAD@{7}: rebase -i (start): checkout master
1edd263 HEAD@{8}: checkout: moving from the-master to the-topic
$ git log -2
commit 7573bced7728fb1063ba1d82252b11fecbcd65e4
Author: James Cameron <quozl@laptop.org>
Date: Fri Dec 30 18:44:58 2016 +1100
Squashed
commit 53c5058da08c11f167087a34d7dc7344d2b86098
Merge: 5efba3e c92d000
Author: Ignacio Rodríguez <ignacio@sugarlabs.org>
Date: Mon Dec 12 01:58:14 2016 -0300
Merge pull request #349 from quozl/2016-347-toolbutton
Write documentation for sugar3.graphics.ToolButton
$ exit
At this point as shown above HEAD has the correct single-patch and is ready for a git push --force
if you were to do it instead of me.
I will squash commits.