Merge pull request #30 from cis-navjot-g/newwork
fix identicon issue for android devices
This commit is contained in:
commit
3f90ec2d83
|
@ -650,7 +650,7 @@ NavigationLayout:
|
||||||
do_scroll_x: False
|
do_scroll_x: False
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
padding: [dp(app.window_size[0]/4*1.1), dp(10)]
|
padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1), dp(10)]
|
||||||
spacing: 12
|
spacing: 12
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0])
|
height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0])
|
||||||
|
|
|
@ -57,9 +57,10 @@ import state
|
||||||
from uikivysignaler import UIkivySignaler
|
from uikivysignaler import UIkivySignaler
|
||||||
# pylint: disable=unused-argument, too-few-public-methods, import-error
|
# pylint: disable=unused-argument, too-few-public-methods, import-error
|
||||||
|
|
||||||
|
import identiconGeneration
|
||||||
if platform == 'linux':
|
import os
|
||||||
import identiconGeneration
|
from kivy.core.clipboard import Clipboard
|
||||||
|
# pylint: disable=unused-argument, too-few-public-methods
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
|
@ -1028,8 +1029,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
|
|
||||||
def getCurrentAccountData(self, text):
|
def getCurrentAccountData(self, text):
|
||||||
"""Get Current Address Account Data."""
|
"""Get Current Address Account Data."""
|
||||||
if platform == 'linux':
|
self.set_identicon(text)
|
||||||
self.set_identicon(text)
|
|
||||||
address_label = self.current_address_label(
|
address_label = self.current_address_label(
|
||||||
BMConfigParser().get(text, 'label'), text)
|
BMConfigParser().get(text, 'label'), text)
|
||||||
self.root_window.children[1].ids.toolbar.title = address_label
|
self.root_window.children[1].ids.toolbar.title = address_label
|
||||||
|
@ -1089,10 +1089,9 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
def getDefaultAccData(self):
|
def getDefaultAccData(self):
|
||||||
"""Getting Default Account Data."""
|
"""Getting Default Account Data."""
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
if platform == 'linux':
|
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
||||||
img = identiconGeneration.generate(BMConfigParser().addresses()[0])
|
self.createFolder('./images/default_identicon/')
|
||||||
self.createFolder('./images/default_identicon/')
|
img.texture.save('./images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]))
|
||||||
img.texture.save('./images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]))
|
|
||||||
return BMConfigParser().addresses()[0]
|
return BMConfigParser().addresses()[0]
|
||||||
return 'Select Address'
|
return 'Select Address'
|
||||||
|
|
||||||
|
@ -1109,8 +1108,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
def get_default_image():
|
def get_default_image():
|
||||||
"""Getting default image on address"""
|
"""Getting default image on address"""
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
if platform == 'linux':
|
return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0])
|
||||||
return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0])
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -78,7 +78,7 @@ void getnumthreads()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD_PTR dwProcessAffinity, dwSystemAffinity;
|
DWORD_PTR dwProcessAffinity, dwSystemAffinity;
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
// cpu_set_t dwProcessAffinity;
|
cpu_set_t dwProcessAffinity;
|
||||||
#elif __OpenBSD__
|
#elif __OpenBSD__
|
||||||
int mib[2], core_count = 0;
|
int mib[2], core_count = 0;
|
||||||
int dwProcessAffinity = 0;
|
int dwProcessAffinity = 0;
|
||||||
|
@ -87,13 +87,13 @@ void getnumthreads()
|
||||||
int dwProcessAffinity = 0;
|
int dwProcessAffinity = 0;
|
||||||
int32_t core_count = 0;
|
int32_t core_count = 0;
|
||||||
#endif
|
#endif
|
||||||
// size_t len = sizeof(dwProcessAffinity);
|
size_t len = sizeof(dwProcessAffinity);
|
||||||
// if (numthreads > 0)
|
if (numthreads > 0)
|
||||||
// return;
|
return;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity);
|
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity);
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
// sched_getaffinity(0, len, &dwProcessAffinity);
|
sched_getaffinity(0, len, &dwProcessAffinity);
|
||||||
#elif __OpenBSD__
|
#elif __OpenBSD__
|
||||||
len2 = sizeof(core_count);
|
len2 = sizeof(core_count);
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
|
@ -106,22 +106,22 @@ void getnumthreads()
|
||||||
else if (sysctlbyname("hw.ncpu", &core_count, &len, 0, 0) == 0)
|
else if (sysctlbyname("hw.ncpu", &core_count, &len, 0, 0) == 0)
|
||||||
numthreads = core_count;
|
numthreads = core_count;
|
||||||
#endif
|
#endif
|
||||||
// for (unsigned int i = 0; i < len * 8; i++)
|
for (unsigned int i = 0; i < len * 8; i++)
|
||||||
// #if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// #if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// if (dwProcessAffinity & (1i64 << i))
|
if (dwProcessAffinity & (1i64 << i))
|
||||||
// #else // CYGWIN/MINGW
|
#else // CYGWIN/MINGW
|
||||||
// if (dwProcessAffinity & (1ULL << i))
|
if (dwProcessAffinity & (1ULL << i))
|
||||||
// #endif
|
#endif
|
||||||
// #elif defined __linux__
|
#elif defined __linux__
|
||||||
// if (CPU_ISSET(i, &dwProcessAffinity))
|
if (CPU_ISSET(i, &dwProcessAffinity))
|
||||||
// #else
|
#else
|
||||||
// if (dwProcessAffinity & (1 << i))
|
if (dwProcessAffinity & (1 << i))
|
||||||
// #endif
|
#endif
|
||||||
// numthreads++;
|
numthreads++;
|
||||||
// if (numthreads == 0) // something failed
|
if (numthreads == 0) // something failed
|
||||||
// numthreads = 1;
|
numthreads = 1;
|
||||||
// printf("Number of threads: %i\n", (int)numthreads);
|
printf("Number of threads: %i\n", (int)numthreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, unsigned long long target)
|
extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, unsigned long long target)
|
||||||
|
@ -146,7 +146,7 @@ extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, un
|
||||||
# else
|
# else
|
||||||
pthread_create(&threads[i], NULL, threadfunc, (void*)&threaddata[i]);
|
pthread_create(&threads[i], NULL, threadfunc, (void*)&threaddata[i]);
|
||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
pthread_setschedparam(threads[i], 0, &schparam);
|
pthread_setschedparam(threads[i], SCHED_IDLE, &schparam);
|
||||||
# else
|
# else
|
||||||
pthread_setschedparam(threads[i], SCHED_RR, &schparam);
|
pthread_setschedparam(threads[i], SCHED_RR, &schparam);
|
||||||
# endif
|
# endif
|
||||||
|
@ -162,4 +162,4 @@ extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, un
|
||||||
free(threads);
|
free(threads);
|
||||||
free(threaddata);
|
free(threaddata);
|
||||||
return successval;
|
return successval;
|
||||||
}
|
}
|
|
@ -44,7 +44,9 @@ requirements =
|
||||||
bitmsghash,
|
bitmsghash,
|
||||||
kivymd,
|
kivymd,
|
||||||
kivy-garden,
|
kivy-garden,
|
||||||
qrcode
|
qrcode,
|
||||||
|
Pillow,
|
||||||
|
msgpack
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -1213,6 +1213,7 @@ class singleWorker(StoppableThread):
|
||||||
powStartTime = time.time()
|
powStartTime = time.time()
|
||||||
initialHash = hashlib.sha512(encryptedPayload).digest()
|
initialHash = hashlib.sha512(encryptedPayload).digest()
|
||||||
trialValue, nonce = proofofwork.run(target, initialHash)
|
trialValue, nonce = proofofwork.run(target, initialHash)
|
||||||
|
print("nonce calculated value#############################", nonce)
|
||||||
logger.info(
|
logger.info(
|
||||||
'(For msg message) Found proof of work %s Nonce: %s',
|
'(For msg message) Found proof of work %s Nonce: %s',
|
||||||
trialValue, nonce
|
trialValue, nonce
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
from string import lower
|
from string import lower
|
||||||
|
try:
|
||||||
|
from kivy.utils import platform
|
||||||
|
except:
|
||||||
|
platform = ''
|
||||||
from debug import logger
|
from debug import logger
|
||||||
import messagetypes
|
import messagetypes
|
||||||
import paths
|
import paths
|
||||||
|
@ -32,7 +35,7 @@ def constructObject(data):
|
||||||
else:
|
else:
|
||||||
return returnObj
|
return returnObj
|
||||||
|
|
||||||
if paths.frozen is not None:
|
if paths.frozen is not None or platform == "android":
|
||||||
import messagetypes.message
|
import messagetypes.message
|
||||||
import messagetypes.vote
|
import messagetypes.vote
|
||||||
else:
|
else:
|
||||||
|
|
20
src/tr.py
20
src/tr.py
|
@ -13,28 +13,24 @@ class translateClass:
|
||||||
else:
|
else:
|
||||||
return self.text
|
return self.text
|
||||||
|
|
||||||
# def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
|
||||||
# return translateText(context, text, n)
|
|
||||||
|
|
||||||
def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
||||||
return text
|
return translateText(context, text, n)
|
||||||
|
|
||||||
|
# def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
||||||
|
# return translateClass(context, text.replace('%','',1))
|
||||||
|
|
||||||
def translateText(context, text, n = None):
|
def translateText(context, text, n = None):
|
||||||
try:
|
try:
|
||||||
enableGUI = state.enableGUI
|
enableGUI = state.enableGUI
|
||||||
except AttributeError: # inside the plugin
|
except AttributeError: # inside the plugin
|
||||||
enableGUI = True
|
enableGUI = True
|
||||||
if enableGUI:
|
if not state.kivy and enableGUI:
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
try:
|
print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
|
||||||
if state.kivy:
|
print 'Error message:', err
|
||||||
pass
|
os._exit(0)
|
||||||
except Exception as err:
|
|
||||||
print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
|
|
||||||
print 'Error message:', err
|
|
||||||
os._exit(0)
|
|
||||||
if n is None:
|
if n is None:
|
||||||
return QtGui.QApplication.translate(context, text)
|
return QtGui.QApplication.translate(context, text)
|
||||||
else:
|
else:
|
||||||
|
|
Reference in New Issue
Block a user