MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / setStatusIcon

Method setStatusIcon

src/bitmessageqt/__init__.py:1584–1646  ·  view source on GitHub ↗
(self, color)

Source from the content-addressed store, hash-verified

1582 connected = False
1583
1584 def setStatusIcon(self, color):
1585 # print 'setting status icon color'
1586 _notifications_enabled = not BMConfigParser().getboolean(
1587 'bitmessagesettings', 'hidetrayconnectionnotifications')
1588 if color == 'red':
1589 self.pushButtonStatusIcon.setIcon(
1590 QtGui.QIcon(":/newPrefix/images/redicon.png"))
1591 shared.statusIconColor = 'red'
1592 # if the connection is lost then show a notification
1593 if self.connected and _notifications_enabled:
1594 self.notifierShow(
1595 'Bitmessage',
1596 _translate("MainWindow", "Connection lost"),
1597 sound.SOUND_DISCONNECTED)
1598 if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp') and \
1599 BMConfigParser().get('bitmessagesettings', 'socksproxytype') == "none":
1600 self.updateStatusBar(
1601 _translate(
1602 "MainWindow",
1603 "Problems connecting? Try enabling UPnP in the Network"
1604 " Settings"
1605 ))
1606 self.connected = False
1607
1608 if self.actionStatus is not None:
1609 self.actionStatus.setText(_translate(
1610 "MainWindow", "Not Connected"))
1611 self.setTrayIconFile("can-icon-24px-red.png")
1612 if color == 'yellow':
1613 if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
1614 self.statusbar.clearMessage()
1615 self.pushButtonStatusIcon.setIcon(
1616 QtGui.QIcon(":/newPrefix/images/yellowicon.png"))
1617 shared.statusIconColor = 'yellow'
1618 # if a new connection has been established then show a notification
1619 if not self.connected and _notifications_enabled:
1620 self.notifierShow(
1621 'Bitmessage',
1622 _translate("MainWindow", "Connected"),
1623 sound.SOUND_CONNECTED)
1624 self.connected = True
1625
1626 if self.actionStatus is not None:
1627 self.actionStatus.setText(_translate(
1628 "MainWindow", "Connected"))
1629 self.setTrayIconFile("can-icon-24px-yellow.png")
1630 if color == 'green':
1631 if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
1632 self.statusbar.clearMessage()
1633 self.pushButtonStatusIcon.setIcon(
1634 QtGui.QIcon(":/newPrefix/images/greenicon.png"))
1635 shared.statusIconColor = 'green'
1636 if not self.connected and _notifications_enabled:
1637 self.notifierShow(
1638 'Bitmessage',
1639 _translate("MainWindow", "Connected"),
1640 sound.SOUND_CONNECTION_GREEN)
1641 self.connected = True

Callers 1

Calls 8

notifierShowMethod · 0.95
updateStatusBarMethod · 0.95
setTrayIconFileMethod · 0.95
BMConfigParserClass · 0.90
_translateFunction · 0.90
safeGetBooleanMethod · 0.80
clearMessageMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected