Re: QElectrotech is freezing / loading time library elements
The multi-language wiki was broken during an update. The translated pages no longer appear in the switch.
https://qelectrotech.org/wiki_new/start?do=index
You are not logged in. Please login or register.
QElectroTech → Code → QElectrotech is freezing / loading time library elements
The multi-language wiki was broken during an update. The translated pages no longer appear in the switch.
https://qelectrotech.org/wiki_new/start?do=index
and what if we index when we open the folder.
instead of everything at start up?
We load all the collection at the start up for use the search engine. If we not do that the search engine will search only for folder already expanded.
Exactly in the sources code, at the start up of Qet we get all files of the element collection and on each of these files we get the name and the information of the element and that all.
The icon of the element are created when the folder is expanded for both speed up the start of qet and limit the memory foot print of qet.
So load only expanded folder could be a great solution (qelectrotech will start instantly) but we lose the search engine.
A solution could to add in each folder a new file with inside the name and information of each element present in the folder but :
1: we must to write new code for that instead of improve existing (And in current state of devel for the 0.8 I don't make big change, I polish existing before the release)
2: We also write code to update these new files with :
-automatic update when add/remove/update new element
-and manual update if a change are made outside of qet)
May be we will do this in future but I prefer to find a magic solution for improve existing code.
I will first create the doc on my PC and then I will forward it there to you.
I think that can work..it will be plain .txt text.
Whoo it's a hard job, good luck and thanks in advance
Can this be done?
Uuid used to compare two elements
The code below is used to keep compatibility with previous version of qet
The uuid store in .elmt file, to compare two elements was created at version svn 4032
@TODO remove this code at version 0.6 or 0.7 (all users should already used the version with uuid)
Compare the xml definition transformed in QString. This method can return a false positive (notably with Qt5,
because the attributes of the xml isn't at the same order,with two instance of qet, for the same element)
git ID 557a2eaa878b8e9d48da1c0256bca0dbfd2d849b 2015-06-28
bdw. I read the .elmt file for the doc, in combination with git.
The search engine filter also on the country language of application selected by user to matche elements name in the query, example : "bobine" if french language is actived, switch country to english in setting, reload collection and retry your querry with "coil"and see.
grep -w -R 'motor' elements/*
is fast, but I understand.
however there must be a way to find the SW locks (QTimer as watchdog)?
Edit :
no multiple threads
Edit :
... or ... if it lives in the GUI thread then it is possible.
Edit : som info for me.
https://www.kdab.com/the-eight-rules-of … readed-qt/
https://doc.qt.io/qt-5/qcoreapplication … boutToQuit
for
https://github.com/qelectrotech/qelectr … /issues/50
Interesting book:
https://www.amazon.com/dp/1789531241
De-Backer wrote:I will first create the doc on my PC and then I will forward it there to you.
I think that can work..it will be plain .txt text.
Whoo it's a hard job, good luck and thanks in advance
this is a start
The main XML element is therefore the “definition” tag. In case we have more than one type of definition in the future, we use the type attribute to specify that this is an element definition.
definition
* Element dimensions
One of the first things to specify when defining an element is its size: width (width) and height (height), in pixels. These two dimensions must be integers multiples of 10. If this is not the case, QET will round them to the next ten (example: 50 for 42 pixels). They determine the size and the bounding rectangle of the element.
- height
- width
* Element hotspot
The element hooking point designates the point hooked to the mouse cursor during a drag'n drop of the element. They must be full coordinates. “Hotspot_x” is the abscissa, “hotspot_y” is the ordinate. The upper left corner of the rectangle delimiting the element is considered to be the origin. If the values provided exceed the bounding rectangle, they will be limited to the size of the element. The hotspot is also the center of rotation used when changing the orientation of the element.
- hotspot_x
- hotspot_y
* Element orientation
It is then necessary to define what are the possible orientations of the element. Element orientation is used when laying conductors but also to prevent the user from turning an element in a direction that would not make sense. The orientation attribute is defined by a series of 4 characters, each character defining the behavior for an orientation.
+ 1 st character: North
+ 2 nd character: East
+ 3 rd character: South
+ 4 th character: West
Each character can have the following value:
+ d for “default”: indicates that, by default, the element is considered to be oriented in this direction. It is absolutely necessary to indicate a default orientation.
+ y for “yes”: the user can orient the element in this direction.
+ n for “no”: the user cannot orient the element in this direction.
Example: orientation = “ydny” means that the element is drawn facing south and can be turned north and west but not east.
- orientation
- link_type ( grep -w -R 'link_type' sources/* ) info from (/sources/factory/elementfactory.cpp)
-- next_report
-- master
-- slave
-- terminal
- hotspot_x (grep -w -R 'hotspot_x' sources/*)
*
- version
*
- type
uuid
* Uuid used to compare two elements
The code below is used to keep compatibility with previous version of qet
The uuid store in .elmt file, to compare two elements was created at version svn 4032
@TODO remove this code at version 0.6 or 0.7 (all users should already used the version with uuid)
Compare the xml definition transformed in QString. This method can return a false positive (notably with Qt5,
because the attributes of the xml isn't at the same order,with two instance of qet, for the same element)
git ID 557a2eaa878b8e9d48da1c0256bca0dbfd2d849b 2015-06-28
- uuid
names
name
*
- lang
-- be
-- nl
-- fr
--
I have yet to find and link the C ++ code
scorpio810
what is the oldest QT version you still compile?
scorpio810
what is the oldest QT version you still compile?
Qt 5.9 for Ubuntu Bionic LTS.
https://packages.ubuntu.com/fr/bionic/qt5-qmake
https://wiki.ubuntu.com/Releases
End of Standard Support .... April 2023 ... we will be obliged to drop it before
De-Backer wrote:scorpio810
what is the oldest QT version you still compile?Qt 5.9 for Ubuntu Bionic LTS.
https://github.com/De-Backer/qelectrote … clean_code
i have removed some code
you can check this if it's ok.
if ok, then I can bring it to the main git repo
(i don't want to pollute the main git repo)
Not much time for the next few days, but I'll try to find some. ;-)
De-Backer wrote:and what if we index when we open the folder.
instead of everything at start up?We load all the collection at the start up for use the search engine. If we not do that the search engine will search only for folder already expanded.
we can't put the search function in a worker thread?
I notice the gui freezes when entering text.
Not much time for the next few days, but I'll try to find some. ;-)
no problem,i have faith in "git merge"
Has JSON ever been proposed as a file for the elements?
I am asking this because the search function returns NULL.
Perhaps this can be faster than XML.
It is certainly more readable than XML.
Has JSON ever been proposed as a file for the elements?
I am asking this because the search function returns NULL.
Perhaps this can be faster than XML.
It is certainly more readable than XML.
No JSON was not proposed.
Elements file are in xml and will stay xml for the following reasons :
-It's the original file format and everything in the code about element are for xml.
-Elements are embedded in the .qet file and .qet file is xml, we don't embedded a JSON collection inside the xml of the .qet.
-JSON need to write new code and so need lot of time and debbuging.
-Not retrocompatible with xml element file (or have two codes, one for xml another for JSON, a big headache and a big sources of bug and weird behavior)
-I think JSON is not faster than xml (pugi xml vs Qt JSON) and if so I think we will don't gain a lot.
They look the problem come from how Windows access to file, I search if something like ram disk can improve the loading of collection.
Don't forget even if qet start-up on windows is slow, he is much faster than before since we use pugixml and multithreading..... but I hope we can do better
Ok thanks, can there be any changes before /*for*/ 0.8 due to the file structure?
I am asking this because I am asked to number the contact points of each element.
(for Terminal block generator)
And if you have any idea how that is planned, let me know.
edited
for => before
I made a start for the wiki:
https://github.com/De-Backer/qelectrote … irror/wiki
can there be any changes before /*for*/ 0.8 due to the file structure?
I am asking this because I am asked to number the contact points of each element.
(for Terminal block generator)
And if you have any idea how that is planned, let me know.
No there is no change on the file format for the 0.8.
Martin work on a harness feature and if I remember well add terminal number.
The 0.8 dev is now in a state of stabilization before the release, I only add minor change and bug fix.
For the 0.9 version, I will create integrated terminal strip generator, it was previously planned for the 0.8 but the 0.7 begin to be a little old. I prefer release around one version by year.
Nice your wiki
Thanks for the head up.
The 0.8 dev is now in a state of stabilization
I am making a test to make all the elements in 1 file to see the loading difference
for QElectrotech is freezing
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
/**
* @brief QETProject::init
*/
void QETProject::init()
{
connect(&m_titleblocks_collection, &TitleBlockTemplatesCollection::changed, this, &QETProject::updateDiagramsTitleBlockTemplate);
connect(&m_titleblocks_collection, &TitleBlockTemplatesCollection::aboutToRemove, this, &QETProject::removeDiagramsTitleBlockTemplate);
m_undo_stack = new QUndoStack(this);
connect(m_undo_stack, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackChanged(bool)));
m_save_backup_timer.setInterval(BACKUP_INTERVAL);
connect(&m_save_backup_timer, &QTimer::timeout, this, &QETProject::writeBackup);
m_save_backup_timer.start();
writeBackup();
this cannot be stopped: in de setting
m_save_backup_timer.setInterval(BACKUP_INTERVAL);
connect(&m_save_backup_timer, &QTimer::timeout, this, &QETProject::writeBackup);
m_save_backup_timer.start();
runs :
/**
* @brief QETProject::writeBackup
* Write a backup file of this project, in the case that QET crash
*/
void QETProject::writeBackup()
{
if (!m_backup_file ||
(!m_backup_file->isOpen() && !m_backup_file->open(QIODevice::ReadWrite))) {
return;
}
QDomDocument xml_project(toXml());
QET::writeToFile(xml_project, m_backup_file);
}
in de gui thread
I made a start for the wiki:
https://github.com/De-Backer/qelectrote … irror/wiki
I copied your pages, tomorrow I will add you if you want to write on the Github Wiki.
https://github.com/qelectrotech/qelectr … irror/wiki
sure, no problem.
I have not finished adding info, so expect me to ask you som questions.
-about design choice
-and many other relevant things.
Where is the multi thread in QElectroTech?
Is it QtConcurrent?
https://doc.qt.io/qt-5/qtconcurrent-index.html
Or are there others?
Where is the multi thread in QElectroTech?
Is it QtConcurrent?
https://doc.qt.io/qt-5/qtconcurrent-index.htmlOr are there others?
https://doc.qt.io/qt-5/qfuture.html
https://git.tuxfamily.org/qet/qet.git/t … l.cpp#n216
De-Backer wrote:Where is the multi thread in QElectroTech?
Is it QtConcurrent?
https://doc.qt.io/qt-5/qtconcurrent-index.htmlOr are there others?
https://doc.qt.io/qt-5/qfuture.html
https://git.tuxfamily.org/qet/qet.git/t … l.cpp#n216
yes is this the only thing? (did I already see in the code)
proposal: to run the storage in another thread
"" Write a backup file of this project, in the case that QET crash"""
QtConcurrent::run(QThreadPool::globalInstance(), function, ...);
for QElectrotech is freezing
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min/** * @brief QETProject::init */ void QETProject::init() { connect(&m_titleblocks_collection, &TitleBlockTemplatesCollection::changed, this, &QETProject::updateDiagramsTitleBlockTemplate); connect(&m_titleblocks_collection, &TitleBlockTemplatesCollection::aboutToRemove, this, &QETProject::removeDiagramsTitleBlockTemplate); m_undo_stack = new QUndoStack(this); connect(m_undo_stack, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackChanged(bool))); m_save_backup_timer.setInterval(BACKUP_INTERVAL); connect(&m_save_backup_timer, &QTimer::timeout, this, &QETProject::writeBackup); m_save_backup_timer.start(); writeBackup();
this cannot be stopped: in de setting
m_save_backup_timer.setInterval(BACKUP_INTERVAL); connect(&m_save_backup_timer, &QTimer::timeout, this, &QETProject::writeBackup); m_save_backup_timer.start();
runs :
]/**
* @brief QETProject::writeBackup
* Write a backup file of this project, in the case that QET crash
*/
void QETProject::writeBackup()
{
if (!m_backup_file ||
(!m_backup_file->isOpen() && !m_backup_file->open(QIODevice::ReadWrite))) {
return;
}
QDomDocument xml_project(toXml());
QET::writeToFile(xml_project, m_backup_file);
}in de gui thread
QElectroTech → Code → QElectrotech is freezing / loading time library elements
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.036 seconds (42% PHP - 58% DB) with 12 queries