[Improvement, partially SOLVED] Pages always display the internal name
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Improvement, partially SOLVED] Pages always display the internal name
If I have a document and create several TechDraw pages, they are initially named Page, Page001, Page002, etc. However, it makes sense to rename the pages, for example, Page.front_view, Page.isometric, Page.elevations, whatever.
Despite the pages being renamed, the tabs that show the names are still shown with the internal name.
Also, it's not possible to arrange which page goes first and which comes second. This is not a problem when you only have two pages, but if you have ten or more, it becomes cumbersome if you decide to create new pages and views later on.
So the improvement would be to be able to see the new names in the tabs, and to order the pages as you wish.
OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14979 (Git)
Build type: Release
Branch: master
Hash: 47536dcd3729d3db106af628d62f2bf449e68c49
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Despite the pages being renamed, the tabs that show the names are still shown with the internal name.
Also, it's not possible to arrange which page goes first and which comes second. This is not a problem when you only have two pages, but if you have ten or more, it becomes cumbersome if you decide to create new pages and views later on.
So the improvement would be to be able to see the new names in the tabs, and to order the pages as you wish.
OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14979 (Git)
Build type: Release
Branch: master
Hash: 47536dcd3729d3db106af628d62f2bf449e68c49
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Last edited by vocx on Thu Oct 25, 2018 6:34 pm, edited 2 times in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: [Improvement] Pages always display the internal name
A group is perfect for ordering the pages. Insert them in the order you want and collapse the view to keep the tree view tidy, if they are not needed.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Improvement] Pages always display the internal name
Yes, Std_Groups do help you organize the pages but it doesn't address the underlying issue. I think by now most users who've been following the development of FreeCAD since 0.16 know to use a lot of groups to keep the Model tree simple and logically organized; however, I think new users experience a bit of confusion when TechDraw Pages seem to behave in an odd way, not respecting name changes, and not being able to be ordered by dragging the tabs.
Besides, if you have many Pages, they are all opened when you first open your file in FreeCAD. Maybe the default should be to not open all TechDraw Pages?
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: [Improvement] Pages always display the internal name
That has been discussed here before; please search the forum, probably the big TechDraw topic.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: [Improvement] Pages always display the internal name
I've been meaning to fix this for a while. Will try to get this into v0.18 before release.
Not really sure how to go about this. I believe the mainWindow arranges the tabs in the order they are created. I'm not sure if there is a convenient way to reorder the tabs. No promises on this one.
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: [Improvement] Pages always display the internal name
If you set "Preferences->TechDraw1->KeepPagesUpToDate" to OFF, Pages will be created, but not drawn at startup. If you want to see a particular Page after startup, change the Page's KeepUpdated property. If you have big complicated drawings, this is the way to go.
Re: [Improvement] Pages always display the internal name
Perhaps you can reuse the code from PartDesign's "Move object after other object".wandererfan wrote: ↑Fri Oct 19, 2018 1:09 pm Not really sure how to go about this. I believe the mainWindow arranges the tabs in the order they are created. I'm not sure if there is a convenient way to reorder the tabs. No promises on this one.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Improvement] Pages always display the internal name
I see. To me this is not very intuitive. In my mind KeepUpdated should keep the 3D model and the projected views synchronized, but it should not affect whether the Pages appear at startup or not. Maybe it's possible to add another property, ShowAtStartup, to each page?wandererfan wrote: ↑Fri Oct 19, 2018 1:17 pm If you set "Preferences->TechDraw1->KeepPagesUpToDate" to OFF, Pages will be created, but not drawn at startup. If you want to see a particular Page after startup, change the Page's KeepUpdated property. If you have big complicated drawings, this is the way to go.
Last edited by vocx on Fri Oct 19, 2018 10:36 pm, edited 1 time in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: [Improvement] Pages always display the internal name
That is the intended purpose of "KeepUpdated". Not drawing the Page(s) at startup was just a side effect that turned out to be useful. Not intuitive, perhaps not even documented. Have to look into that.
Re: [Improvement] Pages always display the internal name
I don't know much Qt but I suspect it's one of the easiest things to do. Many programs nowadays use tabs whether using Gtk+ or Qt, like Gedit, DoubleCommander, Firefox and many others, and changing the order of the tabs is the most normal thing to do. Users practically expect to be able to do this in modern applications.wandererfan wrote: ↑Fri Oct 19, 2018 1:09 pmNot really sure how to go about this. I believe the mainWindow arranges the tabs in the order they are created. I'm not sure if there is a convenient way to reorder the tabs. No promises on this one.
I searched online and it seems the component that does this is QTabWidget, https://stackoverflow.com/questions/167 ... tab-window, https://forum.qt.io/topic/30974/setting ... qtabwidget
In this thread the users demonstrate a simple program that subclasses QTabWidget, https://forum.qt.io/topic/67542/drag-ta ... bwidgets/6 They mention needing to define a couple of functions like mouseMoveEvent(), dragMoveEvent(), dropEvent(), etc., to know what to do with the tab when the mouse drags it.
The example from the aforementioned thread creates two panes with two tabs in each pane. The tabs can be moved with the left mouse button. To move a tab from one pane to the other pane, use the right mouse button.
This is the code
Code: Select all
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class Tabs(QTabWidget):
def __init__(self, parent):
super().__init__(parent)
self.parent = parent
self.setAcceptDrops(True)
self.tabBar = self.tabBar()
self.tabBar.setMouseTracking(True)
self.indexTab = None
self.setMovable(True)
self.addTab(QWidget(self), 'Tab One')
self.addTab(QWidget(self), 'Tab Two')
def mouseMoveEvent(self, e):
if e.buttons() != Qt.RightButton:
return
globalPos = self.mapToGlobal(e.pos())
tabBar = self.tabBar
posInTab = tabBar.mapFromGlobal(globalPos)
self.indexTab = tabBar.tabAt(e.pos())
tabRect = tabBar.tabRect(self.indexTab)
pixmap = QPixmap(tabRect.size())
tabBar.render(pixmap,QPoint(),QRegion(tabRect))
mimeData = QMimeData()
drag = QDrag(tabBar)
drag.setMimeData(mimeData)
drag.setPixmap(pixmap)
cursor = QCursor(Qt.OpenHandCursor)
drag.setHotSpot(e.pos() - posInTab)
drag.setDragCursor(cursor.pixmap(),Qt.MoveAction)
dropAction = drag.exec_(Qt.MoveAction)
def dragEnterEvent(self, e):
e.accept()
if e.source().parentWidget() != self:
return
print(self.indexOf(self.widget(self.indexTab)))
self.parent.TABINDEX = self.indexOf(self.widget(self.indexTab))
def dragLeaveEvent(self,e):
e.accept()
def dropEvent(self, e):
print(self.parent.TABINDEX)
if e.source().parentWidget() == self:
return
e.setDropAction(Qt.MoveAction)
e.accept()
counter = self.count()
if counter == 0:
self.addTab(e.source().parentWidget().widget(self.parent.TABINDEX),e.source().tabText(self.parent.TABINDEX))
else:
self.insertTab(counter + 1 ,e.source().parentWidget().widget(self.parent.TABINDEX),e.source().tabText(self.parent.TABINDEX))
class Window(QWidget):
def __init__(self):
super().__init__()
self.TABINDEX = 0
tabWidgetOne = Tabs(self)
tabWidgetTwo = Tabs(self)
layout = QHBoxLayout()
self.moveWidget = None
layout.addWidget(tabWidgetOne)
layout.addWidget(tabWidgetTwo)
self.setLayout(layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())
Code: Select all
python3 window_tabs.py
Code: Select all
line 9: super(Tabs, self).__init__(parent)
line 73: super(Window, self).__init__()
Code: Select all
python2 window_tabs.py
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.