Bugfix in Draft toolbar mode

This commit is contained in:
Yorik van Havre 2012-05-03 18:57:59 -03:00
parent 4e2a6eb1fb
commit 454096a34e
2 changed files with 20 additions and 2 deletions

View File

@ -154,7 +154,7 @@ class DraftTaskPanel:
FreeCADGui.draftToolBar.escape()
FreeCADGui.ActiveDocument.resetEdit()
return True
class DraftToolBar:
"main draft Toolbar"
def __init__(self):
@ -488,6 +488,21 @@ class DraftToolBar:
self.retranslateUi(self.baseWidget)
self.panel = DraftTaskPanel(self.baseWidget,extra)
todo.delay(FreeCADGui.Control.showDialog,self.panel)
else:
# create a dummy task to block the UI during the works
class dummy:
"an empty dialog"
def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Cancel)
def accept(self):
FreeCADGui.ActiveDocument.resetEdit()
return True
def reject(self):
FreeCADGui.draftToolBar.isTaskOn = False
FreeCADGui.draftToolBar.escape()
FreeCADGui.ActiveDocument.resetEdit()
return True
todo.delay(FreeCADGui.Control.showDialog,dummy())
self.setTitle(title)
def selectPlaneUi(self):
@ -871,6 +886,8 @@ class DraftToolBar:
def escape(self):
"escapes the current command"
self.continueMode = False
if not self.taskmode:
self.continueCmd.setChecked(False)
self.finish()
def closeLine(self):

View File

@ -74,7 +74,7 @@ MODALT = MODS[Draft.getParam("modalt")]
# sets defaults on first load
if not FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/").HasGroup("Draft"):
if not FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod").HasGroup("Draft"):
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
p.SetBool("copymode",1)
p.SetBool("alwaysSnap",1)
@ -84,6 +84,7 @@ if not FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/").HasGroup("Dra
p.SetInt("precision",4)
p.SetInt("gridEvery",10)
p.SetFloat("gridSpacing",1.0)
p.SetInt("UiMode",1)
#---------------------------------------------------------------------------
# General functions