Catch ValueError exceptions in all versions of Python when calling
shlex.split().
Closes#941
Reported-by: Niel Buys <nbuys@ncomp.co.za>
Signed-off-by: David Aguilar <davvid@gmail.com>
PySide2 does not provide QtCore.QT_VERSION.
Use the backend-neutral QtCore.__version__.
Closes#938
Reported-by: Mariusz Jaskółka <mar.jaskolka@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
The gitcfg reader will transform the EChoice strings into ints. Make
this work by teaching the ComboBox class to transform values during
set_value().
This fixes the problem where values were not getting updated in the UI
on restart, due to the value being an int and not getting found in the
widget's data.
Signed-off-by: David Aguilar <davvid@gmail.com>
The focus border looks better in more configuration as a nice
subtle 1px border.
Suggested-by: Mariusz Jaskółka <mar.jaskolka@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Newer versions of gnome-terminal (and possibly older versions too)
require the command to run to be specified as additional arguments
instead of as a single string argument.
Add a `cola.terminalshellquote` configuration variable so that users
that need to tweak this behavior for custom terminals can do so.
Fix the usage of gnome-terminal to no longer shellquote arguments when
launching in-terminal commands such as "git difftool".
Fixes#935
Reported-by: Andrew Hemming <andrew.hemming@sky.uk>
Signed-off-by: David Aguilar <davvid@gmail.com>
While this condition has never been spotted in the wild, let's
make sure that we have data before reading it.
Signed-off-by: David Aguilar <davvid@gmail.com>
Avoid getting gpg output from "log" and other commands when the user has
`log.showsignature` configured to true. Override it to false.
Signed-off-by: David Aguilar <davvid@gmail.com>
* status_widget_options:
prefs: reword descriptions for status indent and counts
status: refactor headers totals
doc: added new status options
status: refactor option
status: fixed code style
status: refactor positive condition
widget: Added indentation and total options
Signed-off-by: David Aguilar <davvid@gmail.com>
Use QToolButtons to create the action buttons. This keeps the icons
small and normal looking instead of with a bunch of wasted space around
the icon.
Signed-off-by: David Aguilar <davvid@gmail.com>
* sort_branches:
icons: dark theme version of a-z-order.svg and last-first-order.svg
branch: rework the ref sorting implementation
branch: update tooltip
icons: alphabetize new functions from #930 and fix style
MainView: add model's refs_sort_key to persistent state
BranchesWidget: sort order toggle button
icons: A-Z and last-first sort order images
MainModel: sort key for references
gitcmds.all_refs: arbitrary sort key
Signed-off-by: David Aguilar <davvid@gmail.com>
Add a simple alternative to currentData() so that we can avoid
needing to strictly require Qt 5.2.
Closes#929
Related-to: #924
Reported-by: Mariusz Jaskółka <mar.jaskolka@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Store the "ref_sort" as a simple `int` in the configuration to both
simplify the logic and to separate the configuration values from the
implementation details.
We now store a simple integer instead of the string used by git
to do the sorting. Make the sort setting robust to values that
don't exist by internally modding the int to a known range.
Move the Cycle/Toggle behavior from the Branches widget into a
command object so that the mutation is not done directly in the
widget.
Lastly, keep the view updated via notification rather than explicitly
calling refresh() in various places. This simplifies both the
branches widget and the main widget since it no longer needs to
be responsible for calling refresh().
Related-to: #930
Signed-off-by: David Aguilar <davvid@gmail.com>
* jm4R/themes:
prefs: add appearance tab with themes and DPI options
themes: document themes and add command line option to override it
themes: make themes a bit less distractive
themes: code consistency fixes
themes: add Qt stylesheets themes support
widgets: QFrame instead of QWidget to enable margins/borders styling
Signed-off-by: David Aguilar <davvid@gmail.com>
* xieofxie/fix:
main: show menu 'View' in OSX
branch_test: use assertTrue(is) instead of assertEqual
QWidget::setFocus: it receives Qt::FocusReason or void
branch: fix right click without selection
Signed-off-by: David Aguilar <davvid@gmail.com>
* jm4R/basic_sublodules:
submodules: add update all submodules to cmds, action menu and toolbar
submodules: add update specific submodule to cmds & context menu
Signed-off-by: David Aguilar <davvid@gmail.com>
Older versions of Qt run into infinite loops if setStyleSheet() is
called from particular contexts, likely an event handler that triggered
a refresh (e.g. a focus change via the event filter).
This can be avoided by deferring the setStyleSheet() call so that it
happens the next time the event loop runs.
Signed-off-by: David Aguilar <davvid@gmail.com>
The "Commit" action is most analogous to saving a document, so use the
document-save-symbolic icon from the adwaita icon theme.
Signed-off-by: David Aguilar <davvid@gmail.com>
Qt emits a warning when XDG_SESSION_TYPE=wayland and
XDG_CURRENT_DESKTOP=GNOME because it is currently an unsupported
configuration.
Unset XDG_SESSION_TYPE=wayland when in gnome-shell to silence
the warning. We will need to revert this commit in the future
when [QTBUG-68619](https://bugreports.qt.io/browse/QTBUG-68619)
makes Qt Wayland widgets usable in gnome-shell.
Signed-off-by: David Aguilar <davvid@gmail.com>