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

Provide means for starting the Qt console maximized and with the menu bar hidden #3431

Merged
merged 1 commit into from Jun 15, 2013
Merged

Conversation

dankilman
Copy link
Contributor

Not sure if this is exactly the correct approach to using the config, but what I wanted was the option to start the Qt console as mentioned above.
to use:
IPythonQtConsoleApp.hide_menubar = True
IPythonQtConsoleApp.start_maximized = True

I'm also not sure where should the documentation for these be put.

@ivanov
Copy link
Member

ivanov commented Jun 14, 2013

Hi @dankilman - thanks for your contribution. I haven't checked if the implementation you provide works, but here's a simple patch that demonstrates how you can integrate with the config system, and get the documentation / help string to show up when a user would do ipython qtconsole --help-all:

diff --git a/IPython/frontend/qt/console/qtconsoleapp.py b/IPython/frontend/qt/console/qtconsoleapp.py
index 3aba384..cfe140e 100644
--- a/IPython/frontend/qt/console/qtconsoleapp.py
+++ b/IPython/frontend/qt/console/qtconsoleapp.py
@@ -166,6 +166,8 @@ class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp):
     stylesheet = Unicode('', config=True,
         help="path to a custom CSS stylesheet")

+    weirdo_option = CBool(False, config=True, help="this is a weirdo option")
+
     plain = CBool(False, config=True,
         help="Use a plaintext widget instead of rich text (plain can't print/save).")

and with a change like that, the docs show up when you run:

$ ipython qtconsole --help-all | grep -A1 weirdo
--IPythonQtConsoleApp.weirdo_option=<CBool>
    Default: False
    this is a weirdo option

So go ahead and add another commit (or better yet, if you're feeling adventures, make the changes and then --amend this commit and make the first line say something in just 50 character. You'll have to force when you git push this branch, afterward, but that's ok, since it's just your working copy)

@dankilman
Copy link
Contributor Author

Thanks. Looks better now.

@@ -113,6 +113,9 @@ def gui_excepthook(exctype, value, tb):

editor = 'IPythonWidget.editor',
paging = 'ConsoleWidget.paging',

hide_menubar = 'IPythonQtConsoleApp.hide_menubar',
start_maximized = 'IPythonQtConsoleApp.start_maximized',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these need aliases. Everything is still configurable, even without aliases.

@ellisonbg
Copy link
Member

What exactly does hide_menubar hide? On OS X, I don't see a difference?

Also, maybe the simpler name maximize?

@dankilman
Copy link
Contributor Author

@ellisonbg It silently ignores hide_menubar configuration on OSX. I tested this on linux.
I simply repeated the logic I saw MainWindow.init_menu_bar() which doesn't provide an option to toggle the menu bar as its always displayed.
As to the name maximize - Agreed.

@ellisonbg
Copy link
Member

Ahh, great I missed the skip logic on OS X. Once you change the name I will give it another review and merge. Thanks!

@dankilman
Copy link
Contributor Author

@ellisonbg Done.


maximize = CBool(False, config=True,
help="Start the console window maximized.")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these aliases, every configurable is always available, even if they aren't added to the shortlist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a duplicate of your previous comment?
I removed the aliases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, yes. I thought I forgot to make that comment. Please ignore me :)

@ellisonbg
Copy link
Member

Looks great, merging.

ellisonbg added a commit that referenced this pull request Jun 15, 2013
Provide means for starting the Qt console maximized and with the menu bar hidden
@ellisonbg ellisonbg merged commit 28c0fd9 into ipython:master Jun 15, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Provide means for starting the Qt console maximized and with the menu bar hidden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants