本文整理汇总了Python中connector.Connector.getWikiVersion方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.getWikiVersion方法的具体用法?Python Connector.getWikiVersion怎么用?Python Connector.getWikiVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.getWikiVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import getWikiVersion [as 别名]
class Model:
"""
class model
"""
def __init__(self, view, config, parent=None):
"""
Constructor for class model
@param view:
@param config:
"""
self.parent = parent
self.view = view
self.config = config
self.pageModel = QStandardItemModel()
self.view.listView.setModel(self.pageModel)
def createConnector(self):
self.view.statusBar().showMessage('connecting...')
self.c = Connector(self.view.serverLineEdit.text(), self.view.userLineEdit.text(),
self.view.passwdLineEdit.text(), '')
print (self.c.getWikiVersion())
self.allPages = self.c.getAllPages()
if (self.allPages != None):
self.view.statusBar().showMessage('connected.')
parentItem = self.pageModel.invisibleRootItem()
for i in self.allPages:
parentItem.appendRow(QStandardItem(i['id']))
self.connected = True
else:
self.view.statusBar().showMessage("Couldn't get pages.")
print ("Couldn't get pages.")
def copySettings(self):
self.config.settings['app_x'] = self.view.pos().x()
self.config.settings['app_y'] = self.view.pos().y()
self.config.settings['app_w'] = self.view.size().width()
self.config.settings['app_h'] = self.view.size().height()
self.config.settings['user'] = str(self.view.userLineEdit.text())
self.config.settings['serverAddress'] = str(self.view.serverLineEdit.text())
self.config.writeConfig()
def readyToSave(self):
if (self.connected):
self.view.save.setDisabled(False)
def displayPage(self, newSelection, oldSelection):
self.pageIndex = self.view.listView.selectionModel().selectedIndexes()
if (self.pageIndex != None):
self.pageName = self.pageIndex[0].data().toString()
if (self.pageName != None):
print ('Selected item: ' + self.pageName)
self.view.statusBar().showMessage('Loading page ' + str(self.pageName))
self.view.textEdit.setText(self.c.getPageText(self.pageName))
def saveCurrentPage(self):
attr = QVariant()
if (self.pageName != None):
self.c.setPageText(self.pageName, self.view.textEdit.document().toPlainText(), attr)
self.view.statusBar().showMessage('Page ' + str(self.pageName) + ' saved.')
def insertBoldText(self):
print ('insert bold text or change text to bold')
self.textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('**' + str(self.textCursor.selectedText()) + '**')
# self.textCursor.setPosition(self.textCursor.position() - 2)
# print self.textCursor.movePosition(QTextCursor.Left, 2)
def insertItalicText(self):
print ('insert italic text or change text to bold')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('//' + str(textCursor.selectedText()) + '//')
def insertH1Text(self):
print ('insert H1 text or change text to H1')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('======' + str(textCursor.selectedText()) + '======')
def insertH2Text(self):
print ('insert H2 text or change text to H2')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('=====' + str(textCursor.selectedText()) + '=====')
def insertH3Text(self):
print ('insert H3 text or change text to H3')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('====' + str(textCursor.selectedText()) + '====')
def insertH4Text(self):
print ('insert H4 text or change text to H4')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('===' + str(textCursor.selectedText()) + '===')
def insertH5Text(self):
print ('insert H5 text or change text to H5')
textCursor = self.view.textEdit.textCursor()
self.view.textEdit.insertPlainText('==' + str(textCursor.selectedText()) + '==')
def searchFor(self):
#.........这里部分代码省略.........