Commit Graph

139 Commits

Author SHA1 Message Date
luz paz
a213071c87 Gui: remove Py2 code from several src/Gui .cpp files 2021-04-14 14:56:02 +02:00
luz paz
f497f09238 Fix typos [skip ci]
Typos ffound via `codespell v2.1.dev0`  
Also includes fixes in deprecated code of `src/Mod/Assembly`
2020-12-28 23:14:04 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
eec776584e Gui: [skip ci] add x3d and xhtml format to export dialog 2020-09-07 16:27:21 +02:00
wmayer
73f89f8cf0 Gui: [skip ci] move Python functions for commands to its own class 2020-08-02 20:50:43 +02:00
wmayer
45e0673645 LGTM: [skip ci] fix: Declaration hides parameter
A local variable hides a parameter. This may be confusing. Consider renaming one of them.
2020-07-27 10:57:34 +02:00
mwganson
2e6133f63f avoid saving to parameters if new shortcut is the default, better check for if setting shortcut was success 2020-07-20 14:11:14 +02:00
mwganson
9052be3e74 return false when unable to set shortcut 2020-07-20 14:11:14 +02:00
Mark Ganson TheMarkster
4e70a108f4 convert tab to spaces 2020-07-20 14:11:14 +02:00
Mark Ganson TheMarkster
488e8e4e6a move preprocessor directives back to column 1 2020-07-20 14:11:14 +02:00
Mark Ganson TheMarkster
e329e6ee03 remove some commented lines 2020-07-20 14:11:14 +02:00
mwganson
dd8b1c0d1f [Python Gui] add new command Gui.setCommandShortcut(), fix bug in Gui.getCommandShortcut() and Gui.getCommandInfo() where user has changed shortcut via customize dialog, but these 2 commands returned previous default information 2020-07-20 14:11:14 +02:00
mwganson
c5c595226d add getCommandInfo() rename getShortcut to getCommandShortcut 2020-04-09 11:43:50 +02:00
mwganson
82d70a114d [skip ci] Add getShortcut(string) command to Gui, returns string value representing shortcut key accelerator for this command 2020-04-09 11:43:50 +02:00
Zheng, Lei
f0f5a1583d Gui: fix FreeCADGui.loadFile() 2020-03-01 16:29:47 +01:00
Zheng, Lei
10e7b3e80e Do not throw error when open an already opened document 2020-02-05 11:12:00 +01:00
Zheng, Lei
4d61820060 Gui: fix Gui.addCommand() in Python3 2019-12-09 00:37:34 +00:00
Markus Lampert
9b8ad9525b Fixed updateCommand definition for python 2019-09-27 11:11:47 +02:00
Zheng, Lei
b69a31c5b5 Gui: add Gui.updateCommands() for manual command status update 2019-09-10 14:17:07 +02:00
Zheng, Lei
b2893691cf Gui: improve Gui.addIcon(), add Gui.isIconCached()
The motivation of this patch is to make it easy for Python workbench
cache its own icons (possibly generated at runtime), saving the trouble
of pre-compiling the icons as binary resources.

* Gui.addIcon() now support a third argument as format. Default format
  is 'XPM' as before. The intention is to allow user to cache other
  format of icon image, like 'PNG'.

* ViewProviderPythonFeature::getIcon() now checks if the given string
  argument is a key to a cached icon.
2019-09-07 16:01:19 +02:00
Zheng, Lei
0c6b1a5d69 Gui: Application/Document/MainWindow changes following App namespace
Application:

* signalNewDocument, check the extra argument, isMainDoc, the decide
  whether to create view of the new document. This is so that external
  linked document can be opened in background without crowding the tab
  list.

* slotDeleteDocument, calls Document::beforeDelete()

* slotActiveDocument, creates view if none, because external document
  is now opened without view.

* onLastWindowClosed(), switch to next active document, and creates view
  if none.

* send(Has)MsgToFocusView(), new API to send message to the active view
  in focus. This is to solve the ambiguity of things like pressing
  delete key, copy, paste handling when the active new is not in focus.
  For example, when spread sheet view is active, delete/copy/paste
  handling should be different when the focus on the spread sheet view
  or focus on tree view.

* tryClose(), delegate to MainWindow for close confirmation

* reopen(), new API to reload a partial document in full

Document/DocumentP:

* _CoinMap, new internal map for quick access view provider from its
  root node.

* slotNewObject, modified to support view provider override from
  App::FeaturePython, through new API
  DocumentObject::getViewProviderNameOverride().

* slotDeletedObject/slotTransactionRemove, improve handling of geo group
  children rebuild

* slotSkipRecompute, add special handling of document with skip
  recompute. Some command cannot work when skip recompute is active.
  For example, sketcher command will check if recompute is successful
  on many commands, and will undo if not. New 'PartialCompute' flag is
  added to allow recompute only the editing object and all its
  dependencies if 'SkipRecompute' is active.

* slotTouchedObject, new signal handling of manually touched object.

* setModified(), do nothing if already modified. This is a critical
  performance improvement, because marking tab window as modified turns
  out to be a relatively expensive operation, and will cause massive
  slow down if calling it on every property change.

* getViewProviderByPathFromHead/getViewProvidersByPath(), new APIs to
  obtain view provider(s) from coin SoPath.

* save/saveAll/saveCopy, modified to support external document saving.

* Save/RestoreDocFile(), save and restore tree item recursive expansion
  status.

* slotFinishRestoreObject(), handle new signal
  signalFinishRestoreObject(), unifies postprocessing in restore and
  import operation.

* createView/setActiveView(), add support of delayed view creations

* canClose(), delegate to MainWindows to ask for confirmation

* undo/redo(), support grouped transaction undo/redo. Transactions may
  be grouped by the same transaction ID if they are triggered by a
  single operation but involves objects from multiple documents.

* toggleInSceneGraph(), new API to add or remove root node from or to
  scenegraph without deleting the view object.

MainWindow:

* Update command status using a single shot timer instead of periodical
  one.

* Improve message display is status bar. Give error and warning message
  higher priority (using QStatusBar::showMessage()) than normal status
  message (using actionLabel), reversed from original implementation.

* confirmSave(), new API to check for modification, and ask user to save
  the document before closing. The confirmation dialog allows user to
  apply the answer to all document for convenience.

* saveAll(), new API to save all document with correct ordering in case
  of external linking.

* createMimeDataFromSelection/insertFromMimeData(), support copy paste
  object with external linking. A new dialog DlgObjectSelection is used
  to let user select exactly which object to export.

CommandDoc/CommandWindow:

* Related changes to object delete, document import, export, and save.
2019-08-17 15:08:33 +02:00
Zheng, Lei
d4ac072306 Gui: support in-place editing
The link support means that an object can now appear in more than one
places, and even inside a document different from its own. This patch
adds support for in-place editing, meaning that the object can be edited
at correct place regardless where it is.

See [here](https://git.io/fjPIk) for more info about the relavent APIs.

This patch includes two example of modifications to support in-place
editing. One is the ViewProviderDragger, which simply adds the dragger
node to editing root node by calling
View3DInventorViewer::setupEditingRoot(dragger). The other much more
complex one is ViewProviderSketch which calls setupEditingRoot(0) to
transfer all its children node into editing root. ViewProviderSketch
also includes various modifications to command invocation, because we
can no longer assume the active document is the owner of the editing
object.

This patch also includes necessary modification of the 'Show' module to
support in-place editing.
2019-08-17 15:08:32 +02:00
Zheng, Lei
5214f5b7ce Gui: add coinRemoveAllChildren to work around Coin3D bug
See bug description:
https://bitbucket.org/Coin3D/coin/pull-requests/119/fix-sochildlist-auditing/diff

Because of path based rendering (SoFCPathAnnotation) in mouse over
highlight, this bug causes crash more frequently here comparing to
upstream.

All C++ calling of SoGroup::removeAllChildren() is replaced by
Gui::coinRemoveAllChildren(), and python code is fixed by monkey
patching SoGroup.removeAllChildren() in FreeCADGuiInit.py.
2019-08-17 14:52:11 +02:00
wmayer
eb05a902aa return boolean to indicate whether workbench could be activated 2019-07-07 19:36:35 +02:00
wmayer
85fddfc54a do some security checks to make sure Py::Module is valid 2019-06-03 17:57:52 +02:00
Joel Graff
c923c9efe5 deleted commented code 2019-05-02 13:37:59 -03:00
Joel Graff
b2ca187d4b fix for edit tracker draw styles 2019-05-02 13:37:59 -03:00
Mateusz Skowroński
ac508516da Use QString's multi-arg overload to save memory allocations. [-Wclazy-qstring-arg] Thanks Clazy! 2019-02-11 15:39:14 +01:00
wmayer
02c51ff2dd if activating a workbench raises a general error then add the name to the message 2018-12-05 11:31:16 +01:00
wmayer
31963f16c1 Fix scan coverity issues:
CID 184294: Uncaught exception
CID 183597: Unchecked return value
CID 175809: Dereference before null check
CID 175810: Logically dead code
CID 133000: Uninitialized scalar variable
CID 133001: Uninitialized scalar variable
CID 183591: Explicit null dereferenced
2018-11-13 16:47:58 +01:00
ickby
835c75421f Add python document observer for GUI documents 2018-10-08 11:04:56 +02:00
wmayer
ef42cfb5d6 add method to activate 3d view when setting active object list 2018-09-12 15:38:28 +02:00
wmayer
ddfa3c8843 remove kwd argument for functions only with flag METH_VARARGS 2018-08-08 17:39:32 +02:00
JimStar
6a5ad383ab Extended global marker size to be used for other modes 2018-07-11 21:22:28 -03:00
JimStar
5a7a765ed6 Implemented a global setting for marker size and support of it for snapping in "Draft" workbench. In future this setting can be used for other markers too, to be able to set them all to comfortable size by just one global setting.
Before that (e.g. on MacBook Pro) it was very hard to see the microscopic selection-circle hidden behind much bigger cursor arrow when trying to snap e.g. a line to some vertex. Now this setting can be used for such displays to increase the marker size and make it clearly visible behind the cursor.
The already existing "sketcher marker size" property is intended to be used for sketcher only, so it's not suitable for global setup of all the markers' sizes uniformly...
2018-07-05 19:05:19 -03:00
wmayer
d7c5f389e2 explicit handling of English/en locale in setLocale and supportedLocales 2018-06-09 20:34:54 +02:00
wmayer
41f51b33ee add methods to set/get locales 2018-06-09 17:31:19 +02:00
wmayer
2cd338ba03 improve whitespaces 2017-11-24 15:43:28 +01:00
wmayer
da4d35ac89 improvements of wait cursor
make filtering of modal dialogs working with Qt5
save/restore filter flags
don't filter events for File > Export
when using showPreferences don't show wait cursor
2017-10-22 19:49:56 +02:00
wmayer
9148412400 + exception handling in FreeCADGui.addModule 2017-07-07 09:58:28 +02:00
Yorik van Havre
7e39fed862 py3: Gui: files A-P ported to python3 2017-05-06 17:23:27 +02:00
wmayer
577ed59fbc switch to PySide2 for Qt5 2016-12-24 15:33:15 +01:00
wmayer
d28743f35e extend creation of preferences pages from Python 2016-10-22 16:48:02 +02:00
wmayer
1e6dcabefc fix -Wextra in FreeCADGui 2016-09-21 20:54:52 +02:00
wmayer
a5bcca3993 support to pass optional item parameter to Gui.runCommand 2016-09-08 09:40:03 +02:00
wmayer
1f77d98fab + add methods to get/set scene graph, add parameter to set window title of viewer 2016-05-01 17:50:40 +02:00
wmayer
88f472d411 + improve whitespaces
+ fix sequence protocol and fix crash
2016-05-01 15:49:00 +02:00
wmayer
c5aebfa872 Squashed commit of the following:
commit 89eb699e69c05dda0ebecf4aa22acc85386ede8f
Author: looooo <sppedflyer@gmail.com>
Date:   Wed Apr 27 21:43:16 2016 +0200

    added close function

commit 2acc25adbc9df47194934ef4db18383919248c7d
Author: looooo <sppedflyer@gmail.com>
Date:   Wed Apr 27 21:12:18 2016 +0200

    some additions to the split-view-bindings

commit ec366d154a96a71c7716900f4de1c109a9160df8
Author: looooo <sppedflyer@gmail.com>
Date:   Sun Apr 24 20:55:26 2016 +0200

    SplitView: Antia-Aliasing, getViewer, handlinging of deletion
    added anti-aliasing for the SplitView3DInventor class
    added method getViewer to the AbstractSplitView
    delete python-object when c++ object gets deleted

commit 7225cd836b0001d302c9e14328b5eb7dd489cdb1
Author: looooo <sppedflyer@gmail.com>
Date:   Sun Apr 24 15:28:57 2016 +0200

    added function Gui.createViewer([int])->Viewer/SplitViewer
2016-05-01 15:46:53 +02:00
Yorik van Havre
e70f6e8a10 added FreeCADGui.listCommands() method 2016-04-27 22:42:22 -03:00
jriegel
8cd51ade8b Active object manager for the Viewer 2016-04-12 18:12:03 +02:00