Merge pull request #85 from bkkcoins/qt-switch-gui
authorThomasV <thomasv1@gmx.de>
Mon, 7 Jan 2013 10:49:03 +0000 (02:49 -0800)
committerThomasV <thomasv1@gmx.de>
Mon, 7 Jan 2013 10:49:03 +0000 (02:49 -0800)
Add Qt button to switch to Lite mode.

1  2 
lib/gui_lite.py
lib/gui_qt.py

diff --cc lib/gui_lite.py
@@@ -86,52 -86,9 +86,52 @@@ def load_theme_paths()
      return theme_paths
  
  
 +def csv_transaction(wallet):
 +    try:
 +        fileName = QFileDialog.getSaveFileName(QWidget(), 'Select file to export your wallet transactions to', os.path.expanduser('~/'), "*.csv")
 +        if fileName:
 +            with open(fileName, "w+") as csvfile:
 +                transaction = csv.writer(csvfile)
 +                transaction.writerow(["transaction_hash","label", "confirmations", "value", "fee", "balance", "timestamp"])
 +                for item in wallet.get_tx_history():
 +                    tx_hash, confirmations, is_mine, value, fee, balance, timestamp = item
 +                    if confirmations:
 +                        if timestamp is not None:
 +                            try:
 +                                time_string = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
 +                            except [RuntimeError, TypeError, NameError] as reason:
 +                                time_string = "unknown"
 +                                pass
 +                        else:
 +                          time_string = "unknown"
 +                    else:
 +                        time_string = "pending"
 +
 +                    if value is not None:
 +                        value_string = format_satoshis(value, True, wallet.num_zeros)
 +                    else:
 +                        value_string = '--'
 +
 +                    if fee is not None:
 +                        fee_string = format_satoshis(fee, True, wallet.num_zeros)
 +                    else:
 +                        fee_string = '0'
 +
 +                    if tx_hash:
 +                        label, is_default_label = wallet.get_label(tx_hash)
 +                    else:
 +                      label = ""
 +
 +                    balance_string = format_satoshis(balance, False, wallet.num_zeros)
 +                    transaction.writerow([tx_hash, label, confirmations, value_string, fee_string, balance_string, time_string])
 +                QMessageBox.information(None,"CSV Export created", "Your CSV export has been succesfully created.")
 +    except (IOError, os.error), reason:
 +        QMessageBox.critical(None,"Unable to create csv", "Electrum was unable to produce a transaction export.\n" + str(reason))
 +
 +
  class ElectrumGui(QObject):
  
-     def __init__(self, wallet, config):
+     def __init__(self, wallet, config, expert=None):
          super(QObject, self).__init__()
  
          self.wallet = wallet
diff --cc lib/gui_qt.py
@@@ -1132,9 -1120,11 +1133,12 @@@ class ElectrumWindow(QMainWindow)
          return textbox
  
      def create_status_bar(self):
 +        self.status_text = ""
          sb = QStatusBar()
          sb.setFixedHeight(35)
+         qtVersion = qVersion()
+         if (int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
+             sb.addPermanentWidget( StatusBarButton( QIcon(":icons/switchgui.png"), "Switch to Lite Mode", self.go_lite ) )
          if self.wallet.seed:
              sb.addPermanentWidget( StatusBarButton( QIcon(":icons/lock.png"), "Password", lambda: self.change_password_dialog(self.wallet, self) ) )
          sb.addPermanentWidget( StatusBarButton( QIcon(":icons/preferences.png"), "Preferences", self.settings_dialog ) )