Draft: Use widgets from QtWidgets
This commit is contained in:
@@ -41,6 +41,7 @@ import sys
|
||||
import math
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
@@ -83,7 +84,7 @@ def _get_incmd_shortcut(itm):
|
||||
# Customized widgets
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class DraftBaseWidget(QtGui.QWidget):
|
||||
class DraftBaseWidget(QtWidgets.QWidget):
|
||||
def __init__(self,parent = None):
|
||||
super().__init__(parent)
|
||||
def eventFilter(self, widget, event):
|
||||
@@ -106,7 +107,7 @@ class DraftDockWidget(DraftBaseWidget):
|
||||
else:
|
||||
super().changeEvent(event)
|
||||
|
||||
class DraftLineEdit(QtGui.QLineEdit):
|
||||
class DraftLineEdit(QtWidgets.QLineEdit):
|
||||
"""custom QLineEdit widget that has the power to catch Escape keypress"""
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -130,7 +131,7 @@ class DraftTaskPanel:
|
||||
else:
|
||||
self.form = widget
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Close)
|
||||
return int(QtWidgets.QDialogButtonBox.Close)
|
||||
def accept(self):
|
||||
if hasattr(FreeCADGui,"draftToolBar"):
|
||||
return FreeCADGui.draftToolBar.validatePoint()
|
||||
@@ -203,7 +204,7 @@ class DraftToolBar:
|
||||
|
||||
# add only a dummy widget, since widgets are created on demand
|
||||
self.baseWidget = DraftBaseWidget()
|
||||
self.tray = QtGui.QToolBar(None)
|
||||
self.tray = QtWidgets.QToolBar(None)
|
||||
self.tray.setObjectName("Draft tray")
|
||||
self.tray.setWindowTitle("Draft tray")
|
||||
self.toptray = self.tray
|
||||
@@ -221,7 +222,7 @@ class DraftToolBar:
|
||||
|
||||
def _pushbutton(self,name, layout, hide=True, icon=None,
|
||||
width=None, checkable=False, square=False):
|
||||
button = QtGui.QPushButton(self.baseWidget)
|
||||
button = QtWidgets.QPushButton(self.baseWidget)
|
||||
button.setObjectName(name)
|
||||
if square:
|
||||
button.setMaximumSize(QtCore.QSize(button.height(), button.height()))
|
||||
@@ -241,7 +242,7 @@ class DraftToolBar:
|
||||
return button
|
||||
|
||||
def _label (self,name, layout, hide=True, wrap=False):
|
||||
label = QtGui.QLabel(self.baseWidget)
|
||||
label = QtWidgets.QLabel(self.baseWidget)
|
||||
label.setObjectName(name)
|
||||
if wrap:
|
||||
label.setWordWrap(True)
|
||||
@@ -264,8 +265,8 @@ class DraftToolBar:
|
||||
inputfield.setObjectName(name)
|
||||
if hide: inputfield.hide()
|
||||
if not width:
|
||||
sizePolicy = QtGui.QSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
sizePolicy = QtWidgets.QSizePolicy(
|
||||
QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
inputfield.setSizePolicy(sizePolicy)
|
||||
inputfield.setMinimumWidth(110)
|
||||
else:
|
||||
@@ -276,10 +277,10 @@ class DraftToolBar:
|
||||
def _spinbox (self,name, layout, val=None, vmax=None,
|
||||
hide=True, double=False, size=None):
|
||||
if double:
|
||||
sbox = QtGui.QDoubleSpinBox(self.baseWidget)
|
||||
sbox = QtWidgets.QDoubleSpinBox(self.baseWidget)
|
||||
sbox.setDecimals(params.get_param("Decimals", path="Units"))
|
||||
else:
|
||||
sbox = QtGui.QSpinBox(self.baseWidget)
|
||||
sbox = QtWidgets.QSpinBox(self.baseWidget)
|
||||
sbox.setObjectName(name)
|
||||
if vmax: sbox.setMaximum(vmax)
|
||||
if val: sbox.setValue(val)
|
||||
@@ -289,7 +290,7 @@ class DraftToolBar:
|
||||
return sbox
|
||||
|
||||
def _checkbox (self,name, layout, checked=True, hide=True):
|
||||
chk = QtGui.QCheckBox(self.baseWidget)
|
||||
chk = QtWidgets.QCheckBox(self.baseWidget)
|
||||
chk.setChecked(checked)
|
||||
chk.setObjectName(name)
|
||||
if hide: chk.hide()
|
||||
@@ -297,7 +298,7 @@ class DraftToolBar:
|
||||
return chk
|
||||
|
||||
def _combo (self,name,layout,hide=True):
|
||||
cb = QtGui.QComboBox(self.baseWidget)
|
||||
cb = QtWidgets.QComboBox(self.baseWidget)
|
||||
cb.setObjectName(name)
|
||||
if hide: cb.hide()
|
||||
layout.addWidget(cb)
|
||||
@@ -316,10 +317,10 @@ class DraftToolBar:
|
||||
|
||||
# point
|
||||
|
||||
xl = QtGui.QHBoxLayout()
|
||||
yl = QtGui.QHBoxLayout()
|
||||
zl = QtGui.QHBoxLayout()
|
||||
bl = QtGui.QHBoxLayout()
|
||||
xl = QtWidgets.QHBoxLayout()
|
||||
yl = QtWidgets.QHBoxLayout()
|
||||
zl = QtWidgets.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(xl)
|
||||
self.layout.addLayout(yl)
|
||||
self.layout.addLayout(zl)
|
||||
@@ -340,19 +341,19 @@ class DraftToolBar:
|
||||
|
||||
# text
|
||||
|
||||
self.textValue = QtGui.QTextEdit(self.baseWidget)
|
||||
self.textValue = QtWidgets.QTextEdit(self.baseWidget)
|
||||
self.textValue.setObjectName("textValue")
|
||||
self.textValue.setTabChangesFocus(True)
|
||||
self.layout.addWidget(self.textValue)
|
||||
self.textValue.hide()
|
||||
tl = QtGui.QHBoxLayout()
|
||||
tl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(tl)
|
||||
self.textOkButton = self._pushbutton("textButton", tl, icon="button_valid")
|
||||
|
||||
# additional line controls
|
||||
|
||||
ll = QtGui.QHBoxLayout()
|
||||
al = QtGui.QHBoxLayout()
|
||||
ll = QtWidgets.QHBoxLayout()
|
||||
al = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(ll)
|
||||
self.layout.addLayout(al)
|
||||
self.labellength = self._label("labellength", ll)
|
||||
@@ -366,33 +367,33 @@ class DraftToolBar:
|
||||
|
||||
# options
|
||||
|
||||
fl = QtGui.QHBoxLayout()
|
||||
fl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(fl)
|
||||
self.numFacesLabel = self._label("numfaceslabel", fl)
|
||||
self.numFaces = self._spinbox("numFaces", fl, 3)
|
||||
ol = QtGui.QHBoxLayout()
|
||||
ol = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(ol)
|
||||
rl = QtGui.QHBoxLayout()
|
||||
rl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(rl)
|
||||
self.labelRadius = self._label("labelRadius", rl)
|
||||
self.radiusValue = self._inputfield("radiusValue", rl)
|
||||
self.radiusValue.setText(FreeCAD.Units.Quantity(0,FreeCAD.Units.Length).UserString)
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.undoButton = self._pushbutton("undoButton", bl, icon='Draft_Rotate')
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.finishButton = self._pushbutton("finishButton", bl, icon='Draft_Finish')
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.closeButton = self._pushbutton("closeButton", bl, icon='Draft_Lock')
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.wipeButton = self._pushbutton("wipeButton", bl, icon='Draft_Wipe')
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.orientWPButton = self._pushbutton("orientWPButton", bl, icon='Draft_SelectPlane')
|
||||
bl = QtGui.QHBoxLayout()
|
||||
bl = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(bl)
|
||||
self.selectButton = self._pushbutton("selectButton", bl, icon='view-select')
|
||||
|
||||
@@ -424,8 +425,8 @@ class DraftToolBar:
|
||||
checked=params.get_param("SubelementMode"))
|
||||
|
||||
# spacer
|
||||
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||
QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum,
|
||||
QtWidgets.QSizePolicy.Expanding)
|
||||
self.layout.addItem(spacerItem)
|
||||
|
||||
QtCore.QObject.connect(self.xValue,QtCore.SIGNAL("valueChanged(double)"),self.changeXValue)
|
||||
@@ -620,7 +621,7 @@ class DraftToolBar:
|
||||
self.isTaskOn = True
|
||||
todo.delay(FreeCADGui.Control.closeDialog,None)
|
||||
self.baseWidget = DraftBaseWidget()
|
||||
self.layout = QtGui.QVBoxLayout(self.baseWidget)
|
||||
self.layout = QtWidgets.QVBoxLayout(self.baseWidget)
|
||||
self.setupToolBar(task=True)
|
||||
self.retranslateUi(self.baseWidget)
|
||||
self.panel = DraftTaskPanel(self.baseWidget,extra)
|
||||
@@ -753,10 +754,10 @@ class DraftToolBar:
|
||||
self.xValue.selectAll()
|
||||
|
||||
def labelUi(self,title=translate("draft","Label"),callback=None):
|
||||
w = QtGui.QWidget()
|
||||
w = QtWidgets.QWidget()
|
||||
w.setWindowTitle(translate("draft","Label type"))
|
||||
l = QtGui.QVBoxLayout(w)
|
||||
combo = QtGui.QComboBox()
|
||||
l = QtWidgets.QVBoxLayout(w)
|
||||
combo = QtWidgets.QComboBox()
|
||||
from draftobjects.label import get_label_types
|
||||
types = get_label_types()
|
||||
for s in types:
|
||||
@@ -788,7 +789,7 @@ class DraftToolBar:
|
||||
self.pointcallback = None
|
||||
self.mask = None
|
||||
self.isTaskOn = False
|
||||
self.baseWidget = QtGui.QWidget()
|
||||
self.baseWidget = QtWidgets.QWidget()
|
||||
|
||||
def trimUi(self,title=translate("draft","Trimex")):
|
||||
self.taskUi(title, icon="Draft_Trimex")
|
||||
@@ -906,9 +907,9 @@ class DraftToolBar:
|
||||
def relocate(self):
|
||||
"""relocates the right-aligned buttons depending on the toolbar size"""
|
||||
if self.baseWidget.geometry().width() < 400:
|
||||
self.layout.setDirection(QtGui.QBoxLayout.TopToBottom)
|
||||
self.layout.setDirection(QtWidgets.QBoxLayout.TopToBottom)
|
||||
else:
|
||||
self.layout.setDirection(QtGui.QBoxLayout.LeftToRight)
|
||||
self.layout.setDirection(QtWidgets.QBoxLayout.LeftToRight)
|
||||
|
||||
def makeDumbTask(self, extra=None, on_close_call=None):
|
||||
"""create a dumb taskdialog to prevent deleting the temp object"""
|
||||
@@ -918,7 +919,7 @@ class DraftToolBar:
|
||||
self.form = [extra]
|
||||
self.callback = callback
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Close)
|
||||
return int(QtWidgets.QDialogButtonBox.Close)
|
||||
def reject(self):
|
||||
if self.callback:
|
||||
self.callback()
|
||||
@@ -1355,11 +1356,11 @@ class DraftToolBar:
|
||||
if hasattr(self.panel,"form"):
|
||||
if isinstance(self.panel.form,list):
|
||||
for w in self.panel.form:
|
||||
c = w.findChild(QtGui.QCheckBox,"ContinueCmd")
|
||||
c = w.findChild(QtWidgets.QCheckBox,"ContinueCmd")
|
||||
if c:
|
||||
c.toggle()
|
||||
else:
|
||||
c = self.panel.form.findChild(QtGui.QCheckBox,"ContinueCmd")
|
||||
c = self.panel.form.findChild(QtWidgets.QCheckBox,"ContinueCmd")
|
||||
if c:
|
||||
c.toggle()
|
||||
except Exception:
|
||||
@@ -1405,7 +1406,7 @@ class DraftToolBar:
|
||||
|
||||
def popupMenu(self,llist,ilist=None,pos=None):
|
||||
"""pops up a menu filled with the given list"""
|
||||
self.groupmenu = QtGui.QMenu()
|
||||
self.groupmenu = QtWidgets.QMenu()
|
||||
for i,l in enumerate(llist):
|
||||
if ilist:
|
||||
self.groupmenu.addAction(ilist[i],l)
|
||||
@@ -1632,26 +1633,26 @@ class FacebinderTaskPanel:
|
||||
def __init__(self):
|
||||
|
||||
self.obj = None
|
||||
self.form = QtGui.QWidget()
|
||||
self.form = QtWidgets.QWidget()
|
||||
self.form.setObjectName("FacebinderTaskPanel")
|
||||
self.grid = QtGui.QGridLayout(self.form)
|
||||
self.grid = QtWidgets.QGridLayout(self.form)
|
||||
self.grid.setObjectName("grid")
|
||||
self.title = QtGui.QLabel(self.form)
|
||||
self.title = QtWidgets.QLabel(self.form)
|
||||
self.grid.addWidget(self.title, 0, 0, 1, 2)
|
||||
|
||||
# tree
|
||||
self.tree = QtGui.QTreeWidget(self.form)
|
||||
self.tree = QtWidgets.QTreeWidget(self.form)
|
||||
self.grid.addWidget(self.tree, 1, 0, 1, 2)
|
||||
self.tree.setColumnCount(2)
|
||||
self.tree.setHeaderLabels(["Name","Subelement"])
|
||||
|
||||
# buttons
|
||||
self.addButton = QtGui.QPushButton(self.form)
|
||||
self.addButton = QtWidgets.QPushButton(self.form)
|
||||
self.addButton.setObjectName("addButton")
|
||||
self.addButton.setIcon(QtGui.QIcon(":/icons/Arch_Add.svg"))
|
||||
self.grid.addWidget(self.addButton, 3, 0, 1, 1)
|
||||
|
||||
self.delButton = QtGui.QPushButton(self.form)
|
||||
self.delButton = QtWidgets.QPushButton(self.form)
|
||||
self.delButton.setObjectName("delButton")
|
||||
self.delButton.setIcon(QtGui.QIcon(":/icons/Arch_Remove.svg"))
|
||||
self.grid.addWidget(self.delButton, 3, 1, 1, 1)
|
||||
@@ -1667,7 +1668,7 @@ class FacebinderTaskPanel:
|
||||
return True
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok)
|
||||
return int(QtWidgets.QDialogButtonBox.Ok)
|
||||
|
||||
def update(self):
|
||||
"""fills the treewidget"""
|
||||
@@ -1676,12 +1677,12 @@ class FacebinderTaskPanel:
|
||||
for f in self.obj.Faces:
|
||||
if isinstance(f[1],tuple):
|
||||
for subf in f[1]:
|
||||
item = QtGui.QTreeWidgetItem(self.tree)
|
||||
item = QtWidgets.QTreeWidgetItem(self.tree)
|
||||
item.setText(0,f[0].Name)
|
||||
item.setIcon(0, QtGui.QIcon(":/icons/Part_3D_object.svg"))
|
||||
item.setText(1,subf)
|
||||
else:
|
||||
item = QtGui.QTreeWidgetItem(self.tree)
|
||||
item = QtWidgets.QTreeWidgetItem(self.tree)
|
||||
item.setText(0,f[0].Name)
|
||||
item.setIcon(0, QtGui.QIcon(":/icons/Part_3D_object.svg"))
|
||||
item.setText(1,f[1])
|
||||
@@ -1739,10 +1740,10 @@ class FacebinderTaskPanel:
|
||||
return True
|
||||
|
||||
def retranslateUi(self, TaskPanel):
|
||||
TaskPanel.setWindowTitle(QtGui.QApplication.translate("draft", "Faces", None))
|
||||
self.delButton.setText(QtGui.QApplication.translate("draft", "Remove", None))
|
||||
self.addButton.setText(QtGui.QApplication.translate("draft", "Add", None))
|
||||
self.title.setText(QtGui.QApplication.translate("draft", "Facebinder elements", None))
|
||||
TaskPanel.setWindowTitle(QtWidgets.QApplication.translate("draft", "Faces", None))
|
||||
self.delButton.setText(QtWidgets.QApplication.translate("draft", "Remove", None))
|
||||
self.addButton.setText(QtWidgets.QApplication.translate("draft", "Add", None))
|
||||
self.title.setText(QtWidgets.QApplication.translate("draft", "Facebinder elements", None))
|
||||
|
||||
#def translateWidget(w, context=None, disAmb=None):
|
||||
# '''translator for items where retranslateUi() is unavailable.
|
||||
@@ -1757,7 +1758,7 @@ class FacebinderTaskPanel:
|
||||
# w.setWindowTitle(newText)
|
||||
|
||||
# #handle children
|
||||
# wKids = w.findChildren(QtGui.QWidget)
|
||||
# wKids = w.findChildren(QtWidgets.QWidget)
|
||||
# for i in wKids:
|
||||
# className = i.metaObject().className()
|
||||
# if hasattr(i,"text") and hasattr(i,"setText"):
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
# @{
|
||||
import json
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
@@ -209,19 +211,19 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest):
|
||||
self.form.pushButtonRename.setEnabled(False)
|
||||
elif index == 1:
|
||||
# Add new... entry
|
||||
reply = QtGui.QInputDialog.getText(None,
|
||||
reply = QtWidgets.QInputDialog.getText(None,
|
||||
"Create new style",
|
||||
"Style name:")
|
||||
if reply[1]:
|
||||
# OK or Enter pressed
|
||||
name = reply[0].strip()
|
||||
if name == "":
|
||||
QtGui.QMessageBox.information(None,
|
||||
QtWidgets.QMessageBox.information(None,
|
||||
"Style name required",
|
||||
"No style name specified")
|
||||
self.form.comboBoxStyles.setCurrentIndex(0)
|
||||
elif name in self.styles:
|
||||
QtGui.QMessageBox.information(None,
|
||||
QtWidgets.QMessageBox.information(None,
|
||||
"Style exists",
|
||||
"This style name already exists")
|
||||
self.form.comboBoxStyles.setCurrentIndex(0)
|
||||
@@ -250,12 +252,12 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest):
|
||||
style = self.form.comboBoxStyles.itemText(index)
|
||||
|
||||
if self.get_style_users(style):
|
||||
reply = QtGui.QMessageBox.question(None,
|
||||
reply = QtWidgets.QMessageBox.question(None,
|
||||
"Style in use",
|
||||
"This style is used by some objects in this document. Are you sure?",
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.No:
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
return
|
||||
self.form.comboBoxStyles.removeItem(index)
|
||||
del self.styles[style]
|
||||
@@ -265,16 +267,16 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest):
|
||||
index = self.form.comboBoxStyles.currentIndex()
|
||||
style = self.form.comboBoxStyles.itemText(index)
|
||||
|
||||
reply = QtGui.QInputDialog.getText(None,
|
||||
reply = QtWidgets.QInputDialog.getText(None,
|
||||
"Rename style",
|
||||
"New name:",
|
||||
QtGui.QLineEdit.Normal,
|
||||
QtWidgets.QLineEdit.Normal,
|
||||
style)
|
||||
if reply[1]:
|
||||
# OK or Enter pressed
|
||||
newname = reply[0]
|
||||
if newname in self.styles:
|
||||
reply = QtGui.QMessageBox.information(None,
|
||||
reply = QtWidgets.QMessageBox.information(None,
|
||||
"Style exists",
|
||||
"This style name already exists")
|
||||
else:
|
||||
@@ -286,8 +288,8 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest):
|
||||
|
||||
def on_import(self):
|
||||
"""Import styles from a json file."""
|
||||
filename = QtGui.QFileDialog.getOpenFileName(
|
||||
QtGui.QApplication.activeWindow(),
|
||||
filename = QtWidgets.QFileDialog.getOpenFileName(
|
||||
QtWidgets.QApplication.activeWindow(),
|
||||
translate("draft","Open styles file"),
|
||||
None,
|
||||
translate("draft","JSON files (*.json *.JSON)"))
|
||||
@@ -306,8 +308,8 @@ class AnnotationStyleEditor(gui_base.GuiCommandSimplest):
|
||||
|
||||
def on_export(self):
|
||||
"""Export styles to a json file."""
|
||||
filename = QtGui.QFileDialog.getSaveFileName(
|
||||
QtGui.QApplication.activeWindow(),
|
||||
filename = QtWidgets.QFileDialog.getSaveFileName(
|
||||
QtWidgets.QApplication.activeWindow(),
|
||||
translate("draft","Save styles file"),
|
||||
None,
|
||||
translate("draft","JSON file (*.json)"))
|
||||
|
||||
@@ -35,7 +35,7 @@ __url__ = "https://www.freecad.org"
|
||||
import math
|
||||
import pivy.coin as coin
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -650,7 +650,7 @@ class Edit(gui_base_original.Modifier):
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
def display_tracker_menu(self, event):
|
||||
self.tracker_menu = QtGui.QMenu()
|
||||
self.tracker_menu = QtWidgets.QMenu()
|
||||
actions = None
|
||||
|
||||
if self.overNode:
|
||||
|
||||
@@ -36,7 +36,7 @@ to the construction group.
|
||||
# @{
|
||||
import PySide.QtCore as QtCore
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from PySide import QtGui
|
||||
from PySide import QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -379,11 +379,11 @@ class Ui_AddNamedGroup():
|
||||
simple label and line edit in dialogbox
|
||||
"""
|
||||
def __init__(self):
|
||||
self.form = QtGui.QWidget()
|
||||
self.form = QtWidgets.QWidget()
|
||||
self.form.setWindowTitle(translate("draft", "Add group"))
|
||||
row = QtGui.QHBoxLayout(self.form)
|
||||
lbl = QtGui.QLabel(translate("draft", "Group name") + ":")
|
||||
self.name = QtGui.QLineEdit()
|
||||
row = QtWidgets.QHBoxLayout(self.form)
|
||||
lbl = QtWidgets.QLabel(translate("draft", "Group name") + ":")
|
||||
self.name = QtWidgets.QLineEdit()
|
||||
row.addWidget(lbl)
|
||||
row.addWidget(self.name)
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class LayerManager:
|
||||
|
||||
def Activated(self):
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide import QtCore, QtGui, QtWidgets
|
||||
|
||||
# store changes to be committed
|
||||
self.deleteList = []
|
||||
@@ -138,7 +138,7 @@ class LayerManager:
|
||||
self.dialog.tree.setItemDelegate(Layers_Delegate())
|
||||
self.dialog.tree.setItemsExpandable(False)
|
||||
self.dialog.tree.setRootIsDecorated(False) # removes spacing in first column
|
||||
self.dialog.tree.setSelectionMode(QtGui.QTreeView.ExtendedSelection) # allow to select many
|
||||
self.dialog.tree.setSelectionMode(QtWidgets.QTreeView.ExtendedSelection) # allow to select many
|
||||
|
||||
# fill the tree view
|
||||
self.update()
|
||||
@@ -379,7 +379,7 @@ class LayerManager:
|
||||
|
||||
"toggle selected layers on/off"
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide import QtCore
|
||||
|
||||
state = None
|
||||
for index in self.dialog.tree.selectedIndexes():
|
||||
@@ -396,7 +396,7 @@ class LayerManager:
|
||||
|
||||
"isolates the selected layers (turns all the others off"
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide import QtCore
|
||||
|
||||
onrows = []
|
||||
for index in self.dialog.tree.selectedIndexes():
|
||||
@@ -409,15 +409,15 @@ class LayerManager:
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Layers_Delegate(QtGui.QStyledItemDelegate):
|
||||
class Layers_Delegate(QtWidgets.QStyledItemDelegate):
|
||||
|
||||
"model delegate"
|
||||
|
||||
def __init__(self, parent=None, *args):
|
||||
|
||||
QtGui.QStyledItemDelegate.__init__(self, parent, *args)
|
||||
QtWidgets.QStyledItemDelegate.__init__(self, parent, *args)
|
||||
# setEditorData() is triggered several times.
|
||||
# But we want to show the color dialog only the first time
|
||||
self.first = True
|
||||
@@ -425,26 +425,26 @@ if FreeCAD.GuiUp:
|
||||
def createEditor(self,parent,option,index):
|
||||
|
||||
if index.column() == 0: # Layer on/off
|
||||
editor = QtGui.QCheckBox(parent)
|
||||
editor = QtWidgets.QCheckBox(parent)
|
||||
if index.column() == 1: # Layer name
|
||||
editor = QtGui.QLineEdit(parent)
|
||||
editor = QtWidgets.QLineEdit(parent)
|
||||
elif index.column() == 2: # Line width
|
||||
editor = QtGui.QSpinBox(parent)
|
||||
editor = QtWidgets.QSpinBox(parent)
|
||||
editor.setMaximum(99)
|
||||
elif index.column() == 3: # Line style
|
||||
editor = QtGui.QComboBox(parent)
|
||||
editor = QtWidgets.QComboBox(parent)
|
||||
editor.addItems(utils.DRAW_STYLES)
|
||||
elif index.column() == 4: # Line color
|
||||
editor = QtGui.QLineEdit(parent)
|
||||
editor = QtWidgets.QLineEdit(parent)
|
||||
self.first = True
|
||||
elif index.column() == 5: # Shape color
|
||||
editor = QtGui.QLineEdit(parent)
|
||||
editor = QtWidgets.QLineEdit(parent)
|
||||
self.first = True
|
||||
elif index.column() == 6: # Transparency
|
||||
editor = QtGui.QSpinBox(parent)
|
||||
editor = QtWidgets.QSpinBox(parent)
|
||||
editor.setMaximum(100)
|
||||
elif index.column() == 7: # Line print color
|
||||
editor = QtGui.QLineEdit(parent)
|
||||
editor = QtWidgets.QLineEdit(parent)
|
||||
self.first = True
|
||||
return editor
|
||||
|
||||
@@ -462,14 +462,14 @@ if FreeCAD.GuiUp:
|
||||
editor.setText(str(index.data(QtCore.Qt.UserRole)))
|
||||
if self.first:
|
||||
c = index.data(QtCore.Qt.UserRole)
|
||||
color = QtGui.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
color = QtWidgets.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
editor.setText(str(color.getRgbF()))
|
||||
self.first = False
|
||||
elif index.column() == 5: # Shape color
|
||||
editor.setText(str(index.data(QtCore.Qt.UserRole)))
|
||||
if self.first:
|
||||
c = index.data(QtCore.Qt.UserRole)
|
||||
color = QtGui.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
color = QtWidgets.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
editor.setText(str(color.getRgbF()))
|
||||
self.first = False
|
||||
elif index.column() == 6: # Transparency
|
||||
@@ -478,7 +478,7 @@ if FreeCAD.GuiUp:
|
||||
editor.setText(str(index.data(QtCore.Qt.UserRole)))
|
||||
if self.first:
|
||||
c = index.data(QtCore.Qt.UserRole)
|
||||
color = QtGui.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
color = QtWidgets.QColorDialog.getColor(QtGui.QColor(int(c[0]*255),int(c[1]*255),int(c[2]*255)))
|
||||
editor.setText(str(color.getRgbF()))
|
||||
self.first = False
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ of one of its points in the Z direction to create a sloped line.
|
||||
|
||||
## \addtogroup draftguitools
|
||||
# @{
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
@@ -84,13 +84,13 @@ class LineSlope(gui_base.GuiCommandNeedsSelection):
|
||||
# TODO: create a .ui file with QtCreator and import it here
|
||||
# instead of creating the interface programmatically,
|
||||
# see the `gui_othoarray` module for an example.
|
||||
w = QtGui.QWidget()
|
||||
w = QtWidgets.QWidget()
|
||||
w.setWindowTitle(translate("Draft", "Slope"))
|
||||
layout = QtGui.QHBoxLayout(w)
|
||||
label = QtGui.QLabel(w)
|
||||
layout = QtWidgets.QHBoxLayout(w)
|
||||
label = QtWidgets.QLabel(w)
|
||||
label.setText(translate("Draft", "Slope")+":")
|
||||
layout.addWidget(label)
|
||||
self.spinbox = QtGui.QDoubleSpinBox(w)
|
||||
self.spinbox = QtWidgets.QDoubleSpinBox(w)
|
||||
self.spinbox.setMinimum(-9999.99)
|
||||
self.spinbox.setMaximum(9999.99)
|
||||
self.spinbox.setSingleStep(0.01)
|
||||
@@ -107,7 +107,7 @@ class LineSlope(gui_base.GuiCommandNeedsSelection):
|
||||
# we must contain our interface inside a parent widget.
|
||||
# Then our interface must be installed in this parent widget
|
||||
# inside the attribute called "form".
|
||||
taskwidget = QtGui.QWidget()
|
||||
taskwidget = QtWidgets.QWidget()
|
||||
taskwidget.form = w
|
||||
|
||||
# The "accept" attribute of the parent widget
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
import os
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
from PySide import QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -305,7 +306,7 @@ class Draft_SetStyle_TaskPanel:
|
||||
|
||||
def onSaveStyle(self):
|
||||
|
||||
reply = QtGui.QInputDialog.getText(None,
|
||||
reply = QtWidgets.QInputDialog.getText(None,
|
||||
translate("Draft", "Save style"),
|
||||
translate("Draft", "Name of this new style:"))
|
||||
if reply[1]:
|
||||
@@ -313,12 +314,12 @@ class Draft_SetStyle_TaskPanel:
|
||||
pdict = self.load()
|
||||
if pdict:
|
||||
if name in pdict:
|
||||
reply = QtGui.QMessageBox.question(None,
|
||||
reply = QtWidgets.QMessageBox.question(None,
|
||||
translate("Draft", "Warning"),
|
||||
translate("Draft", "Name exists. Overwrite?"),
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.No:
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
return
|
||||
preset = self.getValues()
|
||||
pdict[name] = preset
|
||||
|
||||
@@ -41,6 +41,7 @@ import math
|
||||
import pivy.coin as coin
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -1139,7 +1140,7 @@ class Snapper:
|
||||
|
||||
def get_quarter_widget(self, mw):
|
||||
views = []
|
||||
for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget):
|
||||
for w in mw.findChild(QtWidgets.QMdiArea).findChildren(QtWidgets.QWidget):
|
||||
if w.inherits("SIM::Coin3D::Quarter::QuarterWidget"):
|
||||
views.append(w)
|
||||
return views
|
||||
@@ -1473,7 +1474,7 @@ class Snapper:
|
||||
"""Get the snap toolbar."""
|
||||
if not (hasattr(self, "toolbar") and self.toolbar):
|
||||
mw = Gui.getMainWindow()
|
||||
self.toolbar = mw.findChild(QtGui.QToolBar, "Draft snap")
|
||||
self.toolbar = mw.findChild(QtWidgets.QToolBar, "Draft snap")
|
||||
if self.toolbar:
|
||||
return self.toolbar
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
# @{
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -48,45 +49,45 @@ class ScaleTaskPanel:
|
||||
def __init__(self):
|
||||
decimals = params.get_param("Decimals", path="Units")
|
||||
self.sourceCmd = None
|
||||
self.form = QtGui.QWidget()
|
||||
self.form = QtWidgets.QWidget()
|
||||
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_Scale.svg"))
|
||||
layout = QtGui.QGridLayout(self.form)
|
||||
self.xLabel = QtGui.QLabel()
|
||||
layout = QtWidgets.QGridLayout(self.form)
|
||||
self.xLabel = QtWidgets.QLabel()
|
||||
layout.addWidget(self.xLabel, 0, 0, 1, 1)
|
||||
self.xValue = QtGui.QDoubleSpinBox()
|
||||
self.xValue = QtWidgets.QDoubleSpinBox()
|
||||
self.xValue.setRange(0.0000001, 1000000.0)
|
||||
self.xValue.setDecimals(decimals)
|
||||
self.xValue.setValue(1)
|
||||
layout.addWidget(self.xValue,0,1,1,1)
|
||||
self.yLabel = QtGui.QLabel()
|
||||
self.yLabel = QtWidgets.QLabel()
|
||||
layout.addWidget(self.yLabel,1,0,1,1)
|
||||
self.yValue = QtGui.QDoubleSpinBox()
|
||||
self.yValue = QtWidgets.QDoubleSpinBox()
|
||||
self.yValue.setRange(0.0000001, 1000000.0)
|
||||
self.yValue.setDecimals(decimals)
|
||||
self.yValue.setValue(1)
|
||||
layout.addWidget(self.yValue,1,1,1,1)
|
||||
self.zLabel = QtGui.QLabel()
|
||||
self.zLabel = QtWidgets.QLabel()
|
||||
layout.addWidget(self.zLabel,2,0,1,1)
|
||||
self.zValue = QtGui.QDoubleSpinBox()
|
||||
self.zValue = QtWidgets.QDoubleSpinBox()
|
||||
self.zValue.setRange(0.0000001, 1000000.0)
|
||||
self.zValue.setDecimals(decimals)
|
||||
self.zValue.setValue(1)
|
||||
layout.addWidget(self.zValue,2,1,1,1)
|
||||
self.lock = QtGui.QCheckBox()
|
||||
self.lock = QtWidgets.QCheckBox()
|
||||
self.lock.setChecked(params.get_param("ScaleUniform"))
|
||||
layout.addWidget(self.lock,3,0,1,2)
|
||||
self.relative = QtGui.QCheckBox()
|
||||
self.relative = QtWidgets.QCheckBox()
|
||||
self.relative.setChecked(params.get_param("ScaleRelative"))
|
||||
layout.addWidget(self.relative,4,0,1,2)
|
||||
self.isCopy = QtGui.QCheckBox()
|
||||
self.isCopy = QtWidgets.QCheckBox()
|
||||
self.isCopy.setChecked(params.get_param("ScaleCopy"))
|
||||
layout.addWidget(self.isCopy,5,0,1,2)
|
||||
self.isSubelementMode = QtGui.QCheckBox()
|
||||
self.isSubelementMode = QtWidgets.QCheckBox()
|
||||
layout.addWidget(self.isSubelementMode,6,0,1,2)
|
||||
self.isClone = QtGui.QCheckBox()
|
||||
self.isClone = QtWidgets.QCheckBox()
|
||||
layout.addWidget(self.isClone,7,0,1,2)
|
||||
self.isClone.setChecked(params.get_param("ScaleClone"))
|
||||
self.pickrefButton = QtGui.QPushButton()
|
||||
self.pickrefButton = QtWidgets.QPushButton()
|
||||
layout.addWidget(self.pickrefButton,8,0,1,2)
|
||||
QtCore.QObject.connect(self.xValue,QtCore.SIGNAL("valueChanged(double)"),self.setValue)
|
||||
QtCore.QObject.connect(self.yValue,QtCore.SIGNAL("valueChanged(double)"),self.setValue)
|
||||
|
||||
@@ -50,6 +50,6 @@ class SelectPlaneTaskPanel:
|
||||
|
||||
def getStandardButtons(self):
|
||||
"""Execute to set the standard buttons."""
|
||||
return 2097152 # int(QtGui.QDialogButtonBox.Close)
|
||||
return 2097152 # int(QtWidgets.QDialogButtonBox.Close)
|
||||
|
||||
## @}
|
||||
|
||||
@@ -33,6 +33,7 @@ and is populated by various widgets, buttons and menus.
|
||||
# @{
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
@@ -145,13 +146,13 @@ def _set_scale(action):
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
|
||||
scale_widget = sb.findChild(QtGui.QToolBar,"draft_scale_widget")
|
||||
scale_widget = sb.findChild(QtWidgets.QToolBar,"draft_scale_widget")
|
||||
|
||||
if action.text() == translate("draft", "Custom"):
|
||||
title_text = translate("draft", "Set custom scale")
|
||||
dialog_text = translate("draft",
|
||||
"Set custom annotation scale in format x:x, x=x")
|
||||
custom_scale = QtGui.QInputDialog.getText(None, title_text, dialog_text)
|
||||
custom_scale = QtWidgets.QInputDialog.getText(None, title_text, dialog_text)
|
||||
if custom_scale[1]:
|
||||
print(custom_scale[0])
|
||||
scale = label_to_scale(custom_scale[0])
|
||||
@@ -179,7 +180,7 @@ def init_draft_statusbar_scale():
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
|
||||
scale_widget = QtGui.QToolBar()
|
||||
scale_widget = QtWidgets.QToolBar()
|
||||
scale_widget.setObjectName("draft_scale_widget")
|
||||
|
||||
# get scales list according to system units
|
||||
@@ -191,10 +192,10 @@ def init_draft_statusbar_scale():
|
||||
|
||||
# initializes scale widget
|
||||
scale_widget.draft_scales = draft_scales
|
||||
scaleLabel = QtGui.QPushButton("Scale")
|
||||
scaleLabel = QtWidgets.QPushButton("Scale")
|
||||
scaleLabel.setObjectName("ScaleLabel")
|
||||
scaleLabel.setFlat(True)
|
||||
menu = QtGui.QMenu(scaleLabel)
|
||||
menu = QtWidgets.QMenu(scaleLabel)
|
||||
gUnits = QtGui.QActionGroup(menu)
|
||||
for u in draft_scales:
|
||||
a = QtGui.QAction(gUnits)
|
||||
@@ -223,7 +224,7 @@ def init_draft_statusbar_snap():
|
||||
"""
|
||||
empty label instead of snap_widget.addSeparator()
|
||||
"""
|
||||
label = QtGui.QLabel()
|
||||
label = QtWidgets.QLabel()
|
||||
label.setFixedWidth(2)
|
||||
return label
|
||||
|
||||
@@ -232,11 +233,11 @@ def init_draft_statusbar_snap():
|
||||
|
||||
# check if the toolbar is available, without it the required actions
|
||||
# may be missing:
|
||||
if mw.findChild(QtGui.QToolBar, "Draft snap") is None:
|
||||
if mw.findChild(QtWidgets.QToolBar, "Draft snap") is None:
|
||||
return
|
||||
|
||||
# snap widget:
|
||||
snap_widget = QtGui.QToolBar()
|
||||
snap_widget = QtWidgets.QToolBar()
|
||||
snap_widget.setObjectName("draft_snap_widget")
|
||||
snap_widget.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
snap_widget.setIconSize(QtCore.QSize(16, 16))
|
||||
@@ -286,11 +287,11 @@ def show_draft_statusbar():
|
||||
sb = mw.statusBar()
|
||||
|
||||
if params.get_param("DisplayStatusbarScaleWidget"):
|
||||
scale_widget = sb.findChild(QtGui.QToolBar, "draft_scale_widget")
|
||||
scale_widget = sb.findChild(QtWidgets.QToolBar, "draft_scale_widget")
|
||||
if scale_widget:
|
||||
scale_widget.show()
|
||||
else:
|
||||
scale_widget = mw.findChild(QtGui.QToolBar, "draft_scale_widget")
|
||||
scale_widget = mw.findChild(QtWidgets.QToolBar, "draft_scale_widget")
|
||||
if scale_widget:
|
||||
sb.insertPermanentWidget(3, scale_widget)
|
||||
scale_widget.show()
|
||||
@@ -299,12 +300,12 @@ def show_draft_statusbar():
|
||||
t.singleShot(500, init_draft_statusbar_scale)
|
||||
|
||||
if params.get_param("DisplayStatusbarSnapWidget"):
|
||||
snap_widget = sb.findChild(QtGui.QToolBar, "draft_snap_widget")
|
||||
snap_widget = sb.findChild(QtWidgets.QToolBar, "draft_snap_widget")
|
||||
if snap_widget:
|
||||
snap_widget.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
snap_widget.show()
|
||||
else:
|
||||
snap_widget = mw.findChild(QtGui.QToolBar, "draft_snap_widget")
|
||||
snap_widget = mw.findChild(QtWidgets.QToolBar, "draft_snap_widget")
|
||||
if snap_widget:
|
||||
sb.insertPermanentWidget(2, snap_widget)
|
||||
snap_widget.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
@@ -322,11 +323,11 @@ def hide_draft_statusbar():
|
||||
sb = mw.statusBar()
|
||||
|
||||
# hide scale widget
|
||||
scale_widget = sb.findChild(QtGui.QToolBar, "draft_scale_widget")
|
||||
scale_widget = sb.findChild(QtWidgets.QToolBar, "draft_scale_widget")
|
||||
if scale_widget is None:
|
||||
# when switching workbenches, the toolbar sometimes "jumps"
|
||||
# out of the status bar to any other dock area...
|
||||
scale_widget = mw.findChild(QtGui.QToolBar, "draft_scale_widget")
|
||||
scale_widget = mw.findChild(QtWidgets.QToolBar, "draft_scale_widget")
|
||||
if scale_widget:
|
||||
scale_widget.hide()
|
||||
# prevent the widget from showing up as a blank item in the toolbar
|
||||
@@ -334,11 +335,11 @@ def hide_draft_statusbar():
|
||||
scale_widget.toggleViewAction().setVisible(False)
|
||||
|
||||
# hide snap widget
|
||||
snap_widget = sb.findChild(QtGui.QToolBar,"draft_snap_widget")
|
||||
snap_widget = sb.findChild(QtWidgets.QToolBar,"draft_snap_widget")
|
||||
if snap_widget is None:
|
||||
# when switching workbenches, the toolbar sometimes "jumps"
|
||||
# out of the status bar to any other dock area...
|
||||
snap_widget = mw.findChild(QtGui.QToolBar,"draft_snap_widget")
|
||||
snap_widget = mw.findChild(QtWidgets.QToolBar,"draft_snap_widget")
|
||||
if snap_widget:
|
||||
snap_widget.hide()
|
||||
# prevent the widget from showing up as a blank item in the toolbar
|
||||
|
||||
@@ -35,7 +35,7 @@ from draftutils.translate import translate
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
from PySide import QtGui
|
||||
from PySide import QtWidgets
|
||||
|
||||
class ParamObserverDraft:
|
||||
|
||||
@@ -93,7 +93,7 @@ def _param_observer_callback_scalemultiplier(value):
|
||||
return
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
scale_widget = sb.findChild(QtGui.QToolBar,"draft_scale_widget")
|
||||
scale_widget = sb.findChild(QtWidgets.QToolBar,"draft_scale_widget")
|
||||
if scale_widget is not None:
|
||||
scale_label = init_draft_statusbar.scale_to_label(1 / value)
|
||||
scale_widget.scaleLabel.setText(scale_label)
|
||||
@@ -179,10 +179,10 @@ def _param_observer_callback_svg_pattern():
|
||||
msg = translate("draft",
|
||||
"""Do you want to update the SVG pattern options
|
||||
of existing objects in all opened documents?""")
|
||||
res = QtGui.QMessageBox.question(None, "Update SVG patterns", msg,
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||
QtGui.QMessageBox.No)
|
||||
if res == QtGui.QMessageBox.No:
|
||||
res = QtWidgets.QMessageBox.question(None, "Update SVG patterns", msg,
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if res == QtWidgets.QMessageBox.No:
|
||||
return
|
||||
|
||||
for doc, vobjs in data:
|
||||
|
||||
@@ -33,12 +33,12 @@ using the QtCore module.
|
||||
## \addtogroup draftutils
|
||||
# @{
|
||||
import PySide.QtCore as QtCore
|
||||
import PySide.QtGui as QtGui
|
||||
import PySide.QtWidgets as QtWidgets
|
||||
|
||||
Qtranslate = QtCore.QCoreApplication.translate
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
_encoding = QtWidgets.QApplication.UnicodeUTF8
|
||||
except AttributeError:
|
||||
_encoding = None
|
||||
|
||||
@@ -46,7 +46,7 @@ except AttributeError:
|
||||
def translate(context, text, comment=None):
|
||||
r"""Translate the text using the Qt translate function.
|
||||
|
||||
It wraps around `QtGui.QApplication.translate`,
|
||||
It wraps around `QtWidgets.QApplication.translate`,
|
||||
which is the same as `QtCore.QCoreApplication.translate`.
|
||||
|
||||
Parameters
|
||||
@@ -68,7 +68,7 @@ def translate(context, text, comment=None):
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
A unicode string returned by `QtGui.QApplication.translate`.
|
||||
A unicode string returned by `QtWidgets.QApplication.translate`.
|
||||
|
||||
Unicode strings
|
||||
---------------
|
||||
@@ -77,7 +77,7 @@ def translate(context, text, comment=None):
|
||||
In Qt5 the strings are always assumed unicode
|
||||
|
||||
>>> QtCore.QCoreApplication.translate(context, text, None)
|
||||
>>> QtGui.QApplication.translate(context, text, None)
|
||||
>>> QtWidgets.QApplication.translate(context, text, None)
|
||||
"""
|
||||
return Qtranslate(context, text, comment)
|
||||
|
||||
@@ -90,7 +90,7 @@ def translate(context, text, comment=None):
|
||||
#
|
||||
# =============================================================================
|
||||
# try:
|
||||
# _encoding = QtGui.QApplication.UnicodeUTF8 if six.PY2 else None
|
||||
# _encoding = QtWidgets.QApplication.UnicodeUTF8 if six.PY2 else None
|
||||
# def translate(context, text, utf8_decode=True):
|
||||
# """convenience function for Qt translator
|
||||
# context: str
|
||||
|
||||
@@ -76,7 +76,7 @@ if gui:
|
||||
except (AttributeError, NameError):
|
||||
draftui = None
|
||||
from draftutils.translate import translate
|
||||
from PySide import QtGui
|
||||
from PySide import QtWidgets
|
||||
else:
|
||||
def translate(context, txt):
|
||||
return txt
|
||||
@@ -127,7 +127,7 @@ def errorDXFLib(gui):
|
||||
message = translate("Draft", """Download of dxf libraries failed.
|
||||
Please install the dxf Library addon manually
|
||||
from menu Tools -> Addon Manager""")
|
||||
QtGui.QMessageBox.information(None, "", message)
|
||||
QtWidgets.QMessageBox.information(None, "", message)
|
||||
else:
|
||||
FCC.PrintWarning("The DXF import/export libraries needed by FreeCAD to handle the DXF format are not installed.\n")
|
||||
FCC.PrintWarning("Please install the dxf Library addon from Tools -> Addon Manager\n")
|
||||
@@ -144,13 +144,13 @@ Please either enable FreeCAD to download these libraries:
|
||||
Or download these libraries manually, as explained on
|
||||
https://github.com/yorikvanhavre/Draft-dxf-importer
|
||||
To enabled FreeCAD to download these libraries, answer Yes.""")
|
||||
reply = QtGui.QMessageBox.question(None, "", message,
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.Yes:
|
||||
reply = QtWidgets.QMessageBox.question(None, "", message,
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
params.set_param("dxfAllowDownload", True)
|
||||
errorDXFLib(gui)
|
||||
if reply == QtGui.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
pass
|
||||
else:
|
||||
FCC.PrintWarning("The DXF import/export libraries needed by FreeCAD to handle the DXF format are not installed.\n")
|
||||
@@ -2369,18 +2369,18 @@ def processdxf(document, filename, getShapes=False, reComputeFlag=True):
|
||||
if len(edges) > (100):
|
||||
FCC.PrintMessage(str(len(edges)) + " edges to join\n")
|
||||
if gui:
|
||||
d = QtGui.QMessageBox()
|
||||
d = QtWidgets.QMessageBox()
|
||||
d.setText("Warning: High number of entities to join (>100)")
|
||||
d.setInformativeText("This might take a long time "
|
||||
"or even freeze your computer. "
|
||||
"Are you sure? You can also disable "
|
||||
"the 'join geometry' setting in DXF "
|
||||
"import preferences")
|
||||
d.setStandardButtons(QtGui.QMessageBox.Ok
|
||||
| QtGui.QMessageBox.Cancel)
|
||||
d.setDefaultButton(QtGui.QMessageBox.Cancel)
|
||||
d.setStandardButtons(QtWidgets.QMessageBox.Ok
|
||||
| QtWidgets.QMessageBox.Cancel)
|
||||
d.setDefaultButton(QtWidgets.QMessageBox.Cancel)
|
||||
res = d.exec_()
|
||||
if res == QtGui.QMessageBox.Cancel:
|
||||
if res == QtWidgets.QMessageBox.Cancel:
|
||||
FCC.PrintMessage("Aborted\n")
|
||||
return
|
||||
shapes = DraftGeomUtils.findWires(edges)
|
||||
|
||||
@@ -63,7 +63,7 @@ from draftutils.translate import translate
|
||||
from draftutils.messages import _err, _msg, _wrn
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
from PySide import QtGui
|
||||
from PySide import QtWidgets
|
||||
import FreeCADGui
|
||||
gui = True
|
||||
try:
|
||||
@@ -752,14 +752,14 @@ class svgHandler(xml.sax.ContentHandler):
|
||||
_qst = ("Do you wish to use 96 dpi? Choosing 'No' "
|
||||
"will use the older standard 90 dpi.")
|
||||
if FreeCAD.GuiUp:
|
||||
msgBox = QtGui.QMessageBox()
|
||||
msgBox = QtWidgets.QMessageBox()
|
||||
msgBox.setText(translate("ImportSVG", _inf))
|
||||
msgBox.setInformativeText(translate("ImportSVG", _qst))
|
||||
msgBox.setStandardButtons(QtGui.QMessageBox.Yes
|
||||
| QtGui.QMessageBox.No)
|
||||
msgBox.setDefaultButton(QtGui.QMessageBox.No)
|
||||
msgBox.setStandardButtons(QtWidgets.QMessageBox.Yes
|
||||
| QtWidgets.QMessageBox.No)
|
||||
msgBox.setDefaultButton(QtWidgets.QMessageBox.No)
|
||||
ret = msgBox.exec_()
|
||||
if ret == QtGui.QMessageBox.Yes:
|
||||
if ret == QtWidgets.QMessageBox.Yes:
|
||||
self.svgdpi = 96.0
|
||||
else:
|
||||
self.svgdpi = 90.0
|
||||
|
||||
Reference in New Issue
Block a user