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
Added new popwindow module in sugar3.graphics #313
Conversation
|
||
class PopWindow(Gtk.Window): | ||
""" | ||
UI interface for activity Pop-up Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write some docs for this. Here is an example of the format: https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/256/files#diff-74308e345a99a21f5fbfc47f0dbcc070R106
Please add more explanation to the commit description and force push. I've no idea what the intention of the patch is. |
@@ -16,6 +16,7 @@ sugar_PYTHON = \ | |||
palettemenu.py \ | |||
palettewindow.py \ | |||
panel.py \ | |||
popwindow.py \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably mismatch of tab and space characters in this line compared to the lines either side, causing diff to show slight indentation.
3ff1217
to
bef7341
Compare
@samdroid-apps wrote docs for class and methods implemented. |
@AbrahmAB, thanks for changing the commit message, but perhaps I didn't say enough about it. You wrote:
Hope that helps! The purpose of commit messages is to communicate to other programmers now and in the future. Programmers who are doing a bisection to find the cause of a regression need as much information about the change as possible, yet in a form that is readily taken up. |
These pop-up windows don't cover the whole screen. | ||
They contain canvas content, alerts messages, a tray and a | ||
toolbar. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document the constructor kwargs in this section, eg:
Kwargs:
title (type): what is it
set_titlebox (type): what is it
window_xid (type): what is it
@samdroid-apps I have made the following changes in the code
|
@quozl Thanks for your pointing out main points while writing a commit message. |
…-toolkit-gtk3#313) in sugar-toolkit-gtk3
…in sugar-toolkit-gtk3
Oops! I made some typo error while changing the commit message of my PR in sugar repo having reference of this PR, for which I had to |
The api looks good. I'm afk so I cant test it, but I'm sure that @quozl can merge it if he is satisfied. |
Happy to merge into my fork, but I don't think I have community support to merge into Sugar Labs. |
I will test ASAP. Hi everyone btw. |
HALF_WIDTH = ((Gdk.Screen.height() - style.GRID_CELL_SIZE * 5)/2, | ||
(Gdk.Screen.height() - style.GRID_CELL_SIZE * 3)) | ||
|
||
def __init__(self, set_titlebox=True, window_xid=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch is looking great. Just 2 little changes that might polish it up:
- Could we remove the "set_titlebox" property? Most people will just use the titlebox, and it can always be removed via
get_titlebox().hide()
. - Could you add a property or constructor argument that takes one of the size constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding props for size(having tuple of width, height) or separate for width and height.
I would prefer the separate properties. What are your suggestions @samdroid-apps ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having just one prop would be very good developer experience:
popup = PopWindow(PopWindow.FULLSCREEN)
On Thu, Apr 21, 2016 at 7:55 AM, Abhijit Patel
notifications@github.com wrote:
In src/sugar3/graphics/popwindow.py:
- They contain canvas content, alerts messages, a tray and a
- toolbar.
- FULLSCREEN and HALF_WIDTH for setting size of the window.
- Kwargs:
set_titlebox (bool): False if titlebox is not needed
window_xid (xlib.Window): xid of the parent window
- """
- FULLSCREEN = (Gdk.Screen.width() - style.GRID_CELL_SIZE * 5,
Gdk.Screen.height() - style.GRID_CELL_SIZE \* 3)
- HALF_WIDTH = ((Gdk.Screen.height() - style.GRID_CELL_SIZE *
5)/2,(Gdk.Screen.height() - style.GRID_CELL_SIZE \* 3))
- def init(self, set_titlebox=True, window_xid=None,
**kwargs):
Adding props for size(having tuple of width, height) or separate for
width and height.
I would prefer the separate properties. What are your suggestions
@samdroid-apps ?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
Changes made:
|
def __init__(self): | ||
ToolbarBox.__init__(self) | ||
|
||
self.close_button = ToolButton(icon_name='dialog-cancel') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just testing as I was integrating this into bibliography activity. Can you set the "tooltip=_('Close')", to be consistent with existing popups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tooltip
set 👍
# the child class to display the window after modifications | ||
# like chaninging window size, decorating, changing position. | ||
|
||
#self.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this commented code
Forced push with changes:
|
Awsome! Merged! I can't wait to refactor my activities to use this. |
# like chaninging window size, decorating, changing position. | ||
|
||
def set_size(self, size): | ||
width, height = size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way of assigning two variable with one value isn't right. It should be somewhat like this width, height = size_x, size_y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you pass a tuple;
tuple = (1, 200)
a, b = tuple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument for this function is tuple of size itself!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah.. Got it
Possibly a window realisation and size negotiation race. The early stages of You might experiment by moving parts of Or, perhaps @AbrahmAB's design feature of not calling |
Hi Utkarsh, |
@AbrahmAB, the error shows file |
@samdroid-apps , as discussed I have designed the pop-up model here.
Use of this can be seen in my PR in sugar repo.
Link-> sugarlabs/sugar#672