当前位置: 首页>>代码示例>>Python>>正文


Python Console.updateNamespace方法代码示例

本文整理汇总了Python中Console.updateNamespace方法的典型用法代码示例。如果您正苦于以下问题:Python Console.updateNamespace方法的具体用法?Python Console.updateNamespace怎么用?Python Console.updateNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Console的用法示例。


在下文中一共展示了Console.updateNamespace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: import Console [as 别名]
# 或者: from Console import updateNamespace [as 别名]
class MainWindow(QMainWindow, Ui_MainWindow):
	"""
	Class documentation goes here.
	"""

	def __init__(self, parent=None):
		"""
		Constructor
		"""
		QMainWindow.__init__(self, parent)
		self.setupUi(self)


		self.console = Console(startup_message=welcome_message)
		self.console.setStyleSheet(_fromUtf8("font: 75 11pt \"微软雅黑\";\n"
											 "background-color: rgb(245, 245, 245);\n"
											 "color: rgb(0, 0, 0);\n"
											 "selection-color: rgb(255, 170, 0);"))
		self.verticalLayout_6.addWidget(self.console)
		self.console.updateNamespace({'myVar1': app, 'myVar2': 1234})



		self.openFilesPath = ""
		self.userFlag=False
		self.userName=""
		self.userLimits=-1
		self.flag2 = 1
		self.idcount = 100
		self.ip= "127.0.0.1"
		self.host = "CHENGMIN-PC\MSSQLSERVERCM"
		self.user = "sa"
		self.pwd = "111"
		self.isProcess=False
		self.db = "AOPAS_DATABASE"
		"""
		self.ip= ""
		self.host = "Local MySQL55"
		self.user = "chengmin"
		self.pwd = "chengmin123"
		"""

		#self.ms = MSSQL(host=self.ip+"\\"+self.host, user=self.user, pwd=self.pwd, db=self.db)
#

		self.tablename = ""
		self.sqlstr_condition = ""
		self.sqlstrtail = ""
#打开文件
		self.actionOpenFolder.triggered.connect(functools.partial(self.openDirectory,self.actionOpenFolder))
		self.action_f1.triggered.connect(functools.partial(self.openDirectory,self.action_f1))
		self.action_f2.triggered.connect(functools.partial(self.openDirectory,self.action_f2))
#保存文件
		self.actionSave.triggered.connect(functools.partial(self.openDirectory,self.actionSave))
		self.actionS3.triggered.connect(functools.partial(self.openDirectory,self.actionS3))
		self.actionS4.triggered.connect(functools.partial(self.openDirectory,self.actionS4))
#系统退出
		self.actionLoginOut.triggered.connect(functools.partial(self.Quit,self.actionLoginOut))
		self.actionS5.triggered.connect(functools.partial(self.Quit,self.actionS5))
#用户登录
		self.connect(self.actionD1, QtCore.SIGNAL("triggered()"),functools.partial(self.userLogin,self.actionD1))
		self.connect(self.actionLoginIn, QtCore.SIGNAL("triggered()"),functools.partial(self.userLogin,self.actionLoginIn))
#系统设置
		self.connect(self.actionSetting, QtCore.SIGNAL("triggered()"),functools.partial(self.Setting,self.actionSetting))
		self.connect(self.actionT1, QtCore.SIGNAL("triggered()"),functools.partial(self.Setting,self.actionT1))
#数据导入
		self.connect(self.actionImport, QtCore.SIGNAL("triggered()"),functools.partial(self.Import,self.actionImport))
		self.connect(self.actionD2, QtCore.SIGNAL("triggered()"),functools.partial(self.Import,self.actionD2))
#数据删除
		self.actionD3.triggered.connect(self.Delete)
#数据查询
		self.connect(self.actionDpb_Query, QtCore.SIGNAL("triggered()"),functools.partial(self.Query,self.actionDpb_Query))
		self.connect(self.actionD4, QtCore.SIGNAL("triggered()"),functools.partial(self.Query,self.actionD4))
#数据下载
		self.actionD5.triggered.connect(self.D5)
		self.customContextMenuRequested.connect(self.mainwindowRightClick)
#数据排序
		self.actionAscend.triggered.connect(functools.partial(self.Sort,self.actionAscend))
		self.actionDescend.triggered.connect(functools.partial(self.Sort,self.actionDescend))


		self.dtableView.horizontalHeader().sectionClicked.connect(self.dbsectionClicked)
		self.dtableView.horizontalHeader().sectionDoubleClicked.connect(self.dbsectionDoubleClicked)

		self.dtableView.horizontalHeader().setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
		self.dtableView.horizontalHeader().customContextMenuRequested.connect(functools.partial(self.dbRightClicked,self.dtableView))
		#self.dtextEdit.customContextMenuRequested.connect(functools.partial(self.dbRightClicked,self.tableView))
		#self.model = QtSql.QSqlQueryModel()
		self.mplwidget.temp1=[]
		self.dcheckBoxX.checked = True
		self.dcheckBoxX.checked = True
		self.dcheckBoxX.checked = True
		self.Xindex = -1
		self.Yindex = -1
		self.Zindex = -1
		self.Xresult = []
		self.Yresult = []
		self.Zresult = []
		self.YcountA=0
		self.YcountB=0
#.........这里部分代码省略.........
开发者ID:designer357,项目名称:AOPAS,代码行数:103,代码来源:MainWindow.py

示例2: CoinWindow

# 需要导入模块: import Console [as 别名]
# 或者: from Console import updateNamespace [as 别名]

#.........这里部分代码省略.........
            lambda item, column: self.addressLabelClicked(item, column, treeWidget,
                columnAddress=0, columnLabel=1))
        self.connect(treeWidget, QtCore.SIGNAL('itemChanged(QTreeWidgetItem*, int)'),
            lambda item, column: self.addressLabelClicked(item, column, treeWidget,
                columnAddress=0, columnLabel=1))
        self.connect(treeWidget, QtCore.SIGNAL('currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'),
            lambda item, b: self.currentItemChanged(item))

        self.receiveList = treeWidget
        self.receiveButtonsBox = hboxLayout
        hboxLayout.addStretch(1)
        return widget

    def createContactsTab(self):
        treeWidget, widget, hboxLayout = self.createListTab(['Adress', 'Label', 'Tx'])
        treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        treeWidget.customContextMenuRequested.connect(self.createContactMenu)

        for i, width in enumerate(self.columnsWidth['contacts']):
            treeWidget.setColumnWidth(i, width)

        self.connect(treeWidget, QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'),
            lambda a,b: self.addressLabelClicked(a,b,treeWidget, 0, 1))
        self.connect(treeWidget, QtCore.SIGNAL('itemChanged(QTreeWidgetItem*, int)'),
            lambda a,b: self.addressLabelChanged(a,b,treeWidget, 0, 1))

        self.contactList = treeWidget
        self.contactsButtonsLayout = hboxLayout
        hboxLayout.addStretch(1)
        return widget

    def createConsoleTab(self):
        self.console = Console()
        self.console.updateNamespace({'wallet' : self.wallet, 'gui' : self})
        return self.console

    def createListTab(self, headers):
        treeWidget = TreeWidget(self)
        treeWidget.setColumnCount(len(headers))
        treeWidget.setHeaderLabels(headers)

        widget = QtGui.QWidget()
        button = QtGui.QWidget()

        vboxLayout = QtGui.QVBoxLayout()
        vboxLayout.setMargin(0)
        vboxLayout.setSpacing(0)

        hboxLayout = QtGui.QHBoxLayout()
        hboxLayout.setMargin(0)
        hboxLayout.setSpacing(0)
        button.setLayout(hboxLayout)

        vboxLayout.addWidget(treeWidget)
        vboxLayout.addWidget(button)

        widget.setLayout(vboxLayout)
        return treeWidget, widget, hboxLayout

    def createContactMenu(self, position):
        item = self.contactList.itemAt(position)
        print('item')
        if not item:
            return
        print('item yes')
        address = unicode(item.text(0))
开发者ID:dujodujo,项目名称:lemur,代码行数:70,代码来源:Gui.py


注:本文中的Console.updateNamespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。