本文整理汇总了Python中Base.getParam方法的典型用法代码示例。如果您正苦于以下问题:Python Base.getParam方法的具体用法?Python Base.getParam怎么用?Python Base.getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base.getParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Base [as 别名]
# 或者: from Base import getParam [as 别名]
def __init__(self):
FreeCAD.Console.PrintMessage( 'MyDockWidget init begin\n')
self.taskmode = Base.getParam("UiMode")
self.paramcolor = Base.getParam("color")>>8
self.color = QtGui.QColor(self.paramcolor)
self.facecolor = QtGui.QColor(204, 204, 204)
self.linewidth = Base.getParam("linewidth")
self.fontsize = Base.getParam("textheight")
self.paramconstr = Base.getParam("constructioncolor")>>8
self.constrMode = False
self.continueMode = False
self.state = None
self.textbuffer = []
self.crossedViews = []
self.tray = None
self.sourceCmd = None
self.dockWidget = QtGui.QDockWidget()
self.mw = getMainWindow()
self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.dockWidget)
self.centralWidget = QtGui.QWidget()
#self.label = QtGui.QLabel(self.dockWidget)
#self.label.setText("abc")
self.dockWidget.setWidget(self.centralWidget)
self.dockWidget.setVisible(False)
self.dockWidget.toggleViewAction().setVisible(False)
self.layout = QtGui.QHBoxLayout(self.centralWidget)
self.layout.setObjectName("layout")
self.setupToolBar()
self.setupTray()
self.setupStyle()
FreeCAD.Console.PrintMessage( 'MyDockWidget init done\n')
示例2: getDefaultColor
# 需要导入模块: import Base [as 别名]
# 或者: from Base import getParam [as 别名]
def getDefaultColor(self, type, rgb=False):
"gets color from the preferences or toolbar"
if type == "snap":
color = Base.getParam("snapcolor")
r = ((color >> 24) & 0xFF) / 255
g = ((color >> 16) & 0xFF) / 255
b = ((color >> 8) & 0xFF) / 255
elif type == "ui":
r = float(self.color.red() / 255.0)
g = float(self.color.green() / 255.0)
b = float(self.color.blue() / 255.0)
elif type == "face":
r = float(self.facecolor.red() / 255.0)
g = float(self.facecolor.green() / 255.0)
b = float(self.facecolor.blue() / 255.0)
elif type == "constr":
color = QtGui.QColor(Base.getParam("constructioncolor") >> 8)
r = color.red() / 255.0
g = color.green() / 255.0
b = color.blue() / 255.0
else: print "draft: error: couldn't get a color for ", type, " type."
if rgb:
return("rgb(" + str(int(r * 255)) + "," + str(int(g * 255)) + "," + str(int(b * 255)) + ")")
else:
return (r, g, b)