MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / defaultLabel

Method defaultLabel

src/bitmessageqt/foldertree.py:90–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88 self.type = self.NORMAL
89
90 def defaultLabel(self):
91 queryreturn = None
92 retval = None
93 if self.type in (AccountMixin.NORMAL, AccountMixin.CHAN, AccountMixin.MAILINGLIST):
94 try:
95 retval = unicode(BMConfigParser().get(self.address, 'label'), 'utf-8')
96 except Exception as e:
97 queryreturn = sqlQuery(
98 '''select label from addressbook where address=?''', self.address)
99 elif self.type == AccountMixin.SUBSCRIPTION:
100 queryreturn = sqlQuery(
101 '''select label from subscriptions where address=?''', self.address)
102 if queryreturn is not None:
103 if queryreturn != []:
104 for row in queryreturn:
105 retval, = row
106 retval = unicode(retval, 'utf-8')
107 elif self.address is None or self.type == AccountMixin.ALL:
108 return unicode(
109 str(_translate("MainWindow", "All accounts")), 'utf-8')
110 if retval is None:
111 return unicode(self.address, 'utf-8')
112 else:
113 return retval
114
115
116class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin):

Callers 2

treeWidgetItemChangedMethod · 0.80
dataMethod · 0.80

Calls 4

BMConfigParserClass · 0.90
_translateFunction · 0.90
sqlQueryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected