Fixed some inconvenience on first run mainly in Ubuntu.
- immediately return from initCL() if numpy or pyopencl is unevailable (no ImportError because of resetPoW() call) - use glob to find C extension even if it named like `bitmsghash.x86_64-linux-gnu.so` If user chooses to show the Settings dialog: - activate the "Network Settings" tab - remove option 'dontconnect' if settings have been saved
This commit is contained in:
parent
e832ea1689
commit
e6f0b34f9b
|
@ -1619,7 +1619,8 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
self.connectDialogInstance = connectDialog(self)
|
||||
if self.connectDialogInstance.exec_():
|
||||
if self.connectDialogInstance.ui.radioButtonConnectNow.isChecked():
|
||||
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
|
||||
BMConfigParser().remove_option(
|
||||
'bitmessagesettings', 'dontconnect')
|
||||
BMConfigParser().save()
|
||||
else:
|
||||
self.click_actionSettings()
|
||||
|
@ -2349,7 +2350,12 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
|
||||
def click_actionSettings(self):
|
||||
self.settingsDialogInstance = settingsDialog(self)
|
||||
if self._firstrun:
|
||||
self.settingsDialogInstance.ui.tabWidgetSettings.setCurrentIndex(1)
|
||||
if self.settingsDialogInstance.exec_():
|
||||
if self._firstrun:
|
||||
BMConfigParser().remove_option(
|
||||
'bitmessagesettings', 'dontconnect')
|
||||
BMConfigParser().set('bitmessagesettings', 'startonlogon', str(
|
||||
self.settingsDialogInstance.ui.checkBoxStartOnLogon.isChecked()))
|
||||
BMConfigParser().set('bitmessagesettings', 'minimizetotray', str(
|
||||
|
@ -4517,7 +4523,9 @@ def run():
|
|||
myapp.appIndicatorInit(app)
|
||||
myapp.ubuntuMessagingMenuInit()
|
||||
myapp.notifierInit()
|
||||
if BMConfigParser().safeGetBoolean('bitmessagesettings', 'dontconnect'):
|
||||
myapp._firstrun = BMConfigParser().safeGetBoolean(
|
||||
'bitmessagesettings', 'dontconnect')
|
||||
if myapp._firstrun:
|
||||
myapp.showConnectDialog() # ask the user if we may connect
|
||||
|
||||
# try:
|
||||
|
|
|
@ -26,7 +26,9 @@ except:
|
|||
libAvailable = False
|
||||
|
||||
def initCL():
|
||||
global ctx, queue, program, hash_dt
|
||||
global ctx, queue, program, hash_dt, libAvailable
|
||||
if libAvailable is False:
|
||||
return
|
||||
del enabledGpus[:]
|
||||
del vendors[:]
|
||||
del gpus[:]
|
||||
|
@ -98,7 +100,6 @@ def do_opencl_pow(hash, target):
|
|||
# logger.debug("Took %d tries.", progress)
|
||||
return output[0][0]
|
||||
|
||||
if libAvailable:
|
||||
initCL()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -266,9 +266,18 @@ def init():
|
|||
else:
|
||||
try:
|
||||
bso = ctypes.CDLL(os.path.join(paths.codePath(), "bitmsghash", bitmsglib))
|
||||
logger.info("Loaded C PoW DLL %s", bitmsglib)
|
||||
except OSError:
|
||||
import glob
|
||||
try:
|
||||
bso = ctypes.CDLL(glob.glob(os.path.join(
|
||||
paths.codePath(), "bitmsghash", "bitmsghash*.so"
|
||||
))[0])
|
||||
except (OSError, IndexError):
|
||||
bso = None
|
||||
except:
|
||||
bso = None
|
||||
else:
|
||||
logger.info("Loaded C PoW DLL %s", bitmsglib)
|
||||
if bso:
|
||||
try:
|
||||
bmpow = bso.BitmessagePOW
|
||||
|
|
Reference in New Issue
Block a user