Commit Graph

41 Commits

Author SHA1 Message Date
Zheng, Lei
10e7b3e80e Do not throw error when open an already opened document 2020-02-05 11:12:00 +01:00
wmayer
6bf1a623c5 Gui: add function to observe before changing a property 2020-01-13 02:17:39 +01: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
luz.paz
2b02659010 Misc. typo and whitespace fixes
Found via `codespell`
2019-05-30 19:56:12 +02:00
wmayer
36271b4052 move from deprecated boost.signals to boost.signals2 library 2018-10-30 19:09:03 +01:00
ickby
761881fe99 Expose edit signals to Gui observer 2018-10-08 11:06:04 +02: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
e60d0027a2 add some convenience methods for initialization process 2018-08-09 18:41:40 +02:00
wmayer
f3a0b519c9 fix typo 2018-08-09 17:00:41 +02:00
wmayer
ddfa3c8843 remove kwd argument for functions only with flag METH_VARARGS 2018-08-08 17:39:32 +02: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
41f51b33ee add methods to set/get locales 2018-06-09 17:31:19 +02:00
luz.paz
69b3b0b7f2 Misc. typos 2018-05-19 12:06:34 -04:00
luz.paz
9167064fc1 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
wmayer
947f9575de remove Application::runPythonCode 2016-09-15 23:14:31 +02:00
wmayer
25f2de76c3 remove method Application::runCommand 2016-09-15 19:39:16 +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
d7c932d714 Changing active object handling in PartDesign 2016-04-12 18:12:03 +02:00
jriegel
8cd51ade8b Active object manager for the Viewer 2016-04-12 18:12:03 +02:00
Yorik van Havre
263f5951ce Gui: added Gui.showPreferences() python function
This function accepts 2 optional arguments: a string (ex. "Draft")
and an integer (ex. 2). If given, the preferences dialog will open at
the third tab of the Draft group, if existing.
2016-02-02 15:01:42 -02:00
wmayer
c5f6687872 + improve active document handling 2015-10-18 19:35:15 +02:00
wmayer
e5348c743d + rename signal to signalRelabelObject and remove unused code 2015-09-22 17:13:03 +02:00
Mateusz Skowroński
05f95c0506 Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
Yorik van Havre
7f6a22c787 Added Gui.showDownloads() py function to show the download manager, and allow to click https links in webgui browser 2014-08-31 16:51:51 -03:00
Yorik van Havre
d43d389b02 Exposed doCommand (Gui version) to python - fixes #1564 2014-08-05 19:28:36 -03:00
wmayer
2977584307 Expose getMainWindow() to Python 2013-06-30 23:34:24 +02:00
jriegel
415262bc0d Merge branch 'refs/heads/jriegel/develop-fem' 2013-06-27 16:47:40 +02:00
jriegel
212964634a Merge branch 'refs/heads/master' into jriegel/develop-fem
Conflicts:
	src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp
	src/Mod/Fem/App/FemMeshShapeNetgenObject.h
	src/Mod/Fem/Gui/AppFemGuiPy.cpp
	src/Mod/Fem/Gui/Command.cpp
	src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp
	src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h
	src/Mod/Fem/Gui/TaskTetParameter.cpp
	src/Mod/Fem/Gui/TaskTetParameter.h
	src/Mod/Fem/Gui/TaskTetParameter.ui
	src/Mod/Fem/Gui/ViewProviderAnalysis.cpp
	src/Mod/Fem/Gui/ViewProviderAnalysis.h
	src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp
	src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.h
2013-06-26 19:02:15 +02:00
jriegel
a8caab4117 add addModule() macro helper to the python interface of Application 2013-06-09 16:24:07 +02:00
wmayer
5c73243930 0000175: Auto save function (first step) 2013-05-17 13:29:11 +02:00
wmayer
e8b12bdb4d Fix const correctness 2013-04-26 17:08:05 +02:00
Yorik van Havre
c3c6080791 Added FreeCADGui.doCommand() python command 2012-05-31 11:34:01 -03:00
wmayer
78b1282a26 + utility to create edges, faces, shells and solids from selection
+fix a couple of selection bugs in SoFCUnifiedSelection node

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5016 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-14 14:05:28 +00:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00