Moved state.openKeysFile() into bitmessageqt where it's used

Dmitri Bogomolov 4 years ago
parent 185ad66ea5
commit 280095b08f
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

@ -7,6 +7,7 @@ import locale
import os
import random
import string
import subprocess
import sys
import textwrap
import threading
@ -48,7 +49,6 @@ import paths
from proofofwork import getPowType
import queues
import shutdown
import state
from statusbar import BMStatusBar
import sound
# This is needed for tray icon
@ -73,6 +73,15 @@ def powQueueSize():
return queue_len
def openKeysFile():
"""Open keys file with an external editor"""
keysfile = os.path.join(state.appdata, 'keys.dat')
if 'linux' in sys.platform:["xdg-open", keysfile])
elif sys.platform.startswith('win'):
os.startfile(keysfile) # pylint: disable=no-member
class MyForm(settingsmixin.SMainWindow):
# the maximum frequency of message sounds in seconds
@ -1544,7 +1553,7 @@ class MyForm(settingsmixin.SMainWindow):
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)").arg(state.appdata), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
# menu button 'delete all treshed messages'
def click_actionDeleteAllTrashedMessages(self):

@ -253,11 +253,3 @@ def fixSensitiveFilePermissions(filename, hasEnabledKeys):
except Exception:
logger.exception('Keyfile permissions could not be fixed.')
def openKeysFile():
"""Open keys file with an external editor"""
if 'linux' in sys.platform:["xdg-open", state.appdata + 'keys.dat'])
os.startfile(state.appdata + 'keys.dat')