Exemplo n.º 1
0
 def _OnNewBalances(self, wallet, unpaid):
     if unpaid is not None:
         unit = self._Settings['gui']['units']
         unpaid_str = utils.format_balance(unpaid, unit)
         if wallet is not None:
             wallet_str = utils.format_balance(wallet, unit)
             label = f'{wallet_str} ({unpaid_str})'
         else:
             label = f'api keys required ({unpaid_str})'
     else:
         label = ''
     self._Balances.SetLabel(label)
Exemplo n.º 2
0
    def display_status(self,
                       speeds=defaultdict(lambda: [0.0]),
                       revenue=defaultdict(lambda: 0.0),
                       devices=defaultdict(lambda: [])):
        algorithms = list(speeds.keys())
        algorithms.sort(key=lambda algorithm: algorithm.name)
        for algorithm in algorithms:
            data_row = wx.BoxSizer(orient=wx.HORIZONTAL)
            self._algorithms.Add(data_row, wx.SizerFlags().Expand())
            data_row.Add(
                wx.StaticText(
                    self,
                    label='%s (%s)' %
                    (algorithm.name, ', '.join(algorithm.algorithms))),
                wx.SizerFlags().Proportion(2.0))
            data_row.Add(
                wx.StaticText(self,
                              label=utils.format_speeds(speeds[algorithm])),
                wx.SizerFlags().Proportion(1.0))
            data_row.Add(
                wx.StaticText(self,
                              label=utils.format_balance(
                                  revenue[algorithm],
                                  self._settings['gui']['units'])),
                wx.SizerFlags().Proportion(1.0))

            devices_row = wx.BoxSizer(orient=wx.VERTICAL)
            self._algorithms.Add(devices_row, wx.SizerFlags().Expand())
            for device in devices[algorithm]:
                text = wx.StaticText(self, label=device.name)
                if isinstance(device, NvidiaDevice):
                    text.SetBackgroundColour(NVIDIA_COLOR)
                devices_row.Add(
                    text,
                    wx.SizerFlags().Border(wx.ALL, main.PADDING_PX))
Exemplo n.º 3
0
 def _OnMiningStatus(self, speeds, revenue, devices):
     self.DeleteAllItems()
     algorithms = list(speeds.keys())
     algorithms.sort(key=lambda algorithm: algorithm.name)
     for algorithm in algorithms:
         algo = '%s\n(%s)' % (algorithm.name, ', '.join(algorithm.algorithms))
         devicesStr = ','.join([DeviceListRenderer._DeviceToString(device)
                                for device in devices[algorithm]])
         speed = ',\n'.join([utils.format_speed(speed)
                             for speed in speeds[algorithm]])
         pay = utils.format_balance(
             revenue[algorithm], self._Settings['gui']['units'])
         self.AppendItem([algo, devicesStr, speed, pay])
Exemplo n.º 4
0
 def _OnMiningStatus(self, speeds, revenue, devices):
     totalRevenue = sum(revenue.values())
     unit = self._Settings['gui']['units']
     self._Revenue.SetLabel(utils.format_balance(totalRevenue, unit))
Exemplo n.º 5
0
 def _OnNewBalance(self, balance):
     if balance is None:
         self._Balance.SetLabel('')
     else:
         unit = self._Settings['gui']['units']
         self._Balance.SetLabel(utils.format_balance(balance, unit))
Exemplo n.º 6
0
 def set_balance(self, v):
     unit = self._settings['gui']['units']
     self._balance.SetLabel(utils.format_balance(v, unit))