-
Notifications
You must be signed in to change notification settings - Fork 204
Add alternative toolbar for Formatting options #658
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
base: master
Are you sure you want to change the base?
Add alternative toolbar for Formatting options #658
Conversation
6914bf1
to
c4b9ff7
Compare
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.
Sorry for delay with reviewing this. I have left some comments now.
'showToolBarFile': True, | ||
'showToolBarEdit': True, | ||
'showToolBarFormat': True, |
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.
Maybe these names would sound more naturally in English?
'showToolBarFile': True, | |
'showToolBarEdit': True, | |
'showToolBarFormat': True, | |
'showFileToolBar': True, | |
'showEditToolBar': True, | |
'showFormatToolBar': True, |
@@ -33,7 +33,7 @@ | |||
QSpinBox, | |||
QTabWidget, | |||
QVBoxLayout, | |||
QWidget, | |||
QWidget, QGroupBox, QHBoxLayout, |
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 use one import per line and keep the list sorted (you can use isort
tool for that).
self.configurators["showToolBarEdit"].setChecked(self.parent.editBar.toggleViewAction().isChecked()) | ||
self.configurators["showToolBarFormat"].setChecked(self.parent.formatBar.toggleViewAction().isChecked()) | ||
|
||
|
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 don't use two empty lines inside a function, remove one.
<RCC> | ||
<qresource prefix="/icn_format"> | ||
<file>icons/format/light/blockquote.svg</file> | ||
<file>icons/format/light/bold.svg</file> |
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.
At least for bold, italics and underline (and probably also for images, bullets and numbering), it is possible to use theme icons:
- https://specifications.freedesktop.org/icon-naming-spec/latest/
- https://github.com/KDE/oxygen-icons/tree/master/22x22/actions
If the icons exist in the user theme, then it’s preferable to use those, otherwise we use the built-in ones.
But for the built-in ones, please use the existing mechanism (getBundledIcon
function) instead of inventing a new one. This way you won't need the ugly retext_rc.py
file.
@@ -38,6 +38,8 @@ | |||
ReTextWebEnginePreview, | |||
) | |||
from ReText.tabledialog import InsertTableDialog | |||
from ReText.editor import detectThemeVariant | |||
from ReText import retext_rc |
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 add this to line 29 instead.
def _create_menus(self): | ||
self._create_menu_file() | ||
self._create_menu_edit() | ||
self._create_menu_help() |
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.
Similarly, maybe better to name createFileMenu
, createEditMenu
, createHelpMenu
, etc?
By the way, this file uses camelCase
for consistency with Qt. Also, there is no need for leading underscore, since effectively everything is private.
Also, I would be extra grateful if you submit this refactoring as a separate PR, this way I can merge it sooner.
Sure thing, I'll handle all these in a few days, probably this weekend. Regarding the code formatting, do you use any automation tools so you could share its settings? |
In new code I use Adding new |
This PR introduces an alternative way to display the list of available Formatting options in the toolbar. Instead of using a combobox, users can now enable a dedicated toolbar for one-click access. The default combobox is displayed when the new toolbar is disabled via the Configuration dialog or the toolbars' context menu.
Additionally, this PR includes:
window.py
to improve the code structure.