Commit Graph

426 Commits

Author SHA1 Message Date
Uwe
554635cc7d [Gui] rename the Qt header list 2022-03-07 20:35:38 +01:00
wmayer
8f786ea6ef Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
wmayer
91e4e468dd Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
wmayer
5e0cfc64ee App: use forward declarations 2022-03-04 21:09:46 +01:00
wmayer
6c2e1a2d6e Base: implement a lightweight smart pointer for PyObject like Py::Object to reduce includes of Python.h in header files 2022-03-04 15:51:51 +01:00
andrea reale
3a85c7c729 Code clean 2022-03-02 18:55:10 +01:00
andrea reale
192a399b42 fix uninitialized variables 2022-03-01 02:03:44 +01:00
Uwe
a8c912d6f8 [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Zheng, Lei
cd7c208177 Spreadsheet: fix auto completer triggering 2022-02-20 22:09:07 -06:00
Yorik van Havre
e1028eb65e Merged crowdin translations 2022-02-14 12:31:57 +01:00
Yorik van Havre
233182dcd6 Merged crowdin translations 2022-01-26 14:15:14 +01:00
wmayer
978f58e8ab Spreadsheet: unit test for expressions using an input spreadsheet
A bug was reported here: https://forum.freecadweb.org/viewtopic.php?p=564502#p564502
2022-01-24 14:20:26 +01:00
Zheng, Lei
d07479aba7 Spreadsheet: fix dependency calculation on external spreadsheet 2022-01-23 19:43:53 -06:00
wmayer
b35623e680 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
wmayer
8525033bcc Test: [skip ci] clean up documents for unit test with cross links 2022-01-15 16:34:13 +01:00
wmayer
90834eecfe Test: [skip ci] add unit test with cross links
Forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=58603
2022-01-15 14:28:08 +01:00
Yorik van Havre
c24ca51a44 Merged crowdin translations 2022-01-10 11:23:59 +01:00
wmayer
ce05165f21 App: replace three boolean of CellAddress::toString() with a bitmask of enums 2022-01-09 10:39:54 +01:00
wmayer
5e509227d2 Spreadsheet: proper implementation of mp_subscript of Mapping protocol of PropertySheetPy 2022-01-07 19:55:21 +01:00
Mark Ganson TheMarkster
10aae4619a [Spreadsheet] Use DontUseNativeColorDialog parameter when using QtCol… (#5326)
* [Spreadsheet] Use DontUseNativeColorDialog parameter when using QtColorDialog::getColor()
2022-01-05 12:23:14 +01:00
Chris Hennes
42e0cf0c8a [Spreadsheet] Use stylesheet for alias color
When setting the text color for an invalid alias, use the Qt stylesheeet
mechanism rather than QPalette, so that it works correctly with
an applied QSS stylesheeet. Also attempt to detect a darkmode stylesheet
and use lighter shade of red so that the alias is more legible. Finally,
instead of explicitly setting the text color to black when it's valid,
reset to the original stylesheet (usually an empty string). This ensures
that in a dark stylesheet the text color is legible.

Fixes #0004803.
2021-12-29 21:49:00 -06:00
Yorik van Havre
91bfb0fbb6 Merged crowdin translations 2021-12-29 12:20:12 +01:00
Zheng, Lei
89ad08dffd Spreadsheet: code style change 2021-12-21 21:41:02 -07:00
Zheng, Lei
c7255f196b Spreadsheet: improve copy/cut/paste cells
Add color bound around user copy/cut ranges. Do not touch Spreadsheet
object when cutting, only do so when pasting.
2021-12-21 21:41:02 -07:00
Zheng, Lei
fa918d3f7d Spreadsheet: fix handling of absolute cell address 2021-12-21 21:41:02 -07:00
Zheng, Lei
7ebb142b2c Spreadsheet: add menu action 'Configuration table...'
To make it easy for user to create dynamically switchable configuration
tables using spreadsheet.
2021-12-21 21:41:02 -07:00
Zheng, Lei
830bd52af0 Spreadsheet: support mapping protocol in PropertySheetPy
Read only mapping protocol support to retrieve a range of cell values.
Expects the key to be a string of either a single cell address or a
range.
2021-12-21 21:41:02 -07:00
Chris Hennes
a5ca0b7d15 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
Zheng, Lei
753d51aedf Spreadsheet: change alias handling
No longer add dynamic property for alias, simply rely on
get(Dynamic)PropertyByName() to check for aliases.

Add new API PropertyContainer::getPropertyNamedList() so that
ExpressionCompleter can discover properties with aliases.
2021-12-21 21:41:02 -07:00
Chris Hennes
d0394ef878 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
Zheng, Lei
0c2c334f87 Spreadsheet: support cell binding
Cell binding allows one to bind a range of cells of one sheet to another
range of cells of an arbitary sheet, including any empty cells in the
range.

The binding is implemented with PropertyExpressionEngine and
PropertySheet::setPathValue(), which binds a special path of
PropertySheet, such as

    .cells.Bind.A1.D1

to an expression, such as

     tuple(.cells, <<A2>>, <<A5>>)

The A1 and D1 in the example above specifies the binding start and end
cell address. And <<A2>> and <<A5>> are the range of cells to bind to.
Note that you can use any expression that evalutes to string for the
binding destination, e.g. <<A%d>> % B1, which uses the value inside B1
to construct the binding destination. The '.cells' in the tuple shown
above is an example to bind cells of the same PropertySheet. It can be
change to to reference to any other spreadsheet, even those outside the
current document, e.g. Document#Spreadsheet001.cells
2021-12-21 21:41:02 -07:00
Zheng, Lei
55e2c918a9 Spreadsheet: support paste into cell range
For single range copy, the range selection when pasting determines the
start cell and the number of duplications.

For example, when copying a range A1:B2 (i.e. a 2x2 square) and pasting
into a selection of C1:C5 (i.e. a 5x1 vertical line), the square will be
duplicated once in horizontal, but twice in vertical, resulting new
cells range from C1:D4. This logic is borrowed from google sheet.

For multi-ranged copy, no multi duplication is intended. If more than
one selection range exists before pasting, only the top left cell of
the last selected range is used to determine the starting cell for
pasting. The cells will be copied with the exact cell layout keeping any
empty cells in between. This logic is different from google sheet, where
it disallows unalligned multi-ranged copy, and will condense and
eliminate any empty cells for aligned multi-range copy.
2021-12-21 21:41:02 -07:00
wmayer
ada653e591 Add Global.h headers to modules 2021-12-18 14:06:40 +01:00
Mateusz Skowroński
699d2fb197 Fix Qt deprecation warning. QPrinter::setOrientation() is obsolete. 2021-12-11 18:46:29 +01:00
wmayer
45de32c4e1 Spreadsheet: fix format of table cells when used for printing, by default use landscape orientation 2021-12-05 12:16:54 +01:00
wmayer
1d3822822d Spreadsheet: issue 0002957: spreadsheet direct printing 2021-12-04 23:36:11 +01:00
0penBrain
4116a59813 [Sheet][Bugfix] Reject alignment change for merged cell except top-left one 2021-11-21 20:57:33 -06:00
0penBrain
28d10fc6e6 [Sheet] Assert non-null pointer before using it 2021-11-21 20:57:33 -06:00
0penBrain
0e13882a65 [Sheet] Prevent duplicate call to 'nonNullCellAt' 2021-11-21 20:57:33 -06:00
wmayer
049a34645b Mod: change error text of Python wrapper when trying to access deleted view 2021-11-21 19:57:21 +01:00
wmayer
25afe523c4 Spreadsheet: [skip ci] return Py::None() instead of Py::Object() 2021-11-20 14:40:12 +01:00
Chris Hennes
a9ee8d4ffb Spreadsheet: Remove unnecessary functions & files
Remove functions from they Python code for ViewProviderSpreadsheet that
are now in SheetView, and eliminate the unneded files for SheetView now
that it's being generated by hand to facilitate pseudo-inheritance.
2021-11-20 14:40:12 +01:00
Chris Hennes
0da3bc7332 Spreadsheet: Implement Python SheetView functions
Add the following functions to the Python interface of SheetView:
* selectedRanges()
* selectedCells()
* select(cell, flags)
* select(upperLeft, lowerRight, flags)
* currentIndex()
* setCurrentIndex(cell)
2021-11-20 14:40:12 +01:00
wmayer
67cc5c9047 Gui: add MDIViewPy.cast_to_base and implement in Python wrappers for sub-classes of MDIView 2021-11-19 15:44:23 +01:00
Yorik van Havre
c4d4575eb3 Merged crowdin translations 2021-11-16 17:30:39 +01:00
Zheng, Lei
fdae470c1b App: add hiddenref() expression built-in function
Any object reference inside this function is treated as hidden to
exclude it from dependency calculation. This function allows some form
of cyclic depdenency.

Merger note: renamed from "HREF" to "HIDDENREF" to avoid confusion with
the standard "hypertext reference" use of HREF.
2021-11-14 20:45:09 -06:00
wmayer
90630795b8 Spreadsheet: several improvements
* do not simply return with Py_None from Python handler without incrementing the ref. counter as otherwise the interpreter steals a reference and the program will crash after a while
* avoid using the plain Python C API and instead use the PyCXX API
2021-11-13 21:56:15 +01:00
wmayer
7431bddea7 Spreadsheet: get access to the sheet view from the view provider via Python 2021-11-13 21:43:58 +01:00
wmayer
43b3bfcb04 Spreadsheet: in ViewProviderSheet do not add a second member to store the Python wrapper because the base class already has it
and it invalidates the wrapper in case the it is destroyed
2021-11-13 21:34:43 +01:00
wmayer
54688e7267 SpreadSheet: fix -Wunused-parameter 2021-11-13 20:45:06 +01:00