command line argument - path to profile - added. windows qcombobox color fix

This commit is contained in:
ingvar1995 2016-05-06 13:31:18 +03:00
parent 89be47dc72
commit 2b8da1deb4
4 changed files with 63 additions and 52 deletions

View file

@ -13,9 +13,10 @@ import locale
class Toxygen(object):
def __init__(self):
def __init__(self, path=None):
super(Toxygen, self).__init__()
self.tox = self.ms = self.init = self.mainloop = self.avloop = None
self.path = path
def main(self):
"""
@ -28,7 +29,13 @@ class Toxygen(object):
with open(curr_directory() + '/styles/style.qss') as fl:
dark_style = fl.read()
app.setStyleSheet(dark_style)
if self.path is not None:
path = os.path.dirname(self.path.encode(locale.getpreferredencoding())) + '/'
name = os.path.basename(self.path.encode(locale.getpreferredencoding()))[:-4]
data = ProfileHelper.open_profile(path, name)
settings = Settings(name)
self.tox = tox_factory(data, settings)
else:
auto_profile = Settings.get_auto_profile()
if not auto_profile:
# show login screen if default profile not found
@ -252,6 +259,8 @@ class Toxygen(object):
if __name__ == '__main__':
# TODO: add command line options
if len(sys.argv) == 1:
toxygen = Toxygen()
else: # path to profile
toxygen = Toxygen(sys.argv[1])
toxygen.main()

View file

@ -668,7 +668,7 @@ QComboBox QAbstractItemView
background-color: #201F1F;
border-radius: 2px;
border: 1px solid #444;
selection-background-color: #3d8ec9;
selection-background-color: #A9A9A9;
}
QComboBox::drop-down

View file

@ -32,6 +32,7 @@ def bin_to_string(raw_id, length):
class Tox(object):
libtoxcore = LibToxCore()
def __init__(self, tox_options=None, tox_pointer=None):
@ -57,9 +58,9 @@ class Tox(object):
raise MemoryError('The function was unable to allocate enough '
'memory to store the internal structures for the Tox object.')
elif tox_err_new == TOX_ERR_NEW['PORT_ALLOC']:
raise MemoryError('The function was unable to bind to a port. This may mean that all ports have already'
' been bound, e.g. by other Tox instances, or it may mean a permission error. You may'
' be able to gather more information from errno.')
raise RuntimeError('The function was unable to bind to a port. This may mean that all ports have '
'already been bound, e.g. by other Tox instances, or it may mean a permission error.'
' You may be able to gather more information from errno.')
elif tox_err_new == TOX_ERR_NEW['PROXY_BAD_TYPE']:
raise ArgumentError('proxy_type was invalid.')
elif tox_err_new == TOX_ERR_NEW['PROXY_BAD_HOST']:

View file

@ -27,14 +27,15 @@ def convert_time(t):
return '%02d:%02d' % (h, m)
# obsolete
def get_style(style):
if style != 'default':
return style
else:
if system() == 'Linux':
return 'gtk'
elif system() == 'Windows':
if system() == 'Windows':
return 'windows'
else:
return 'gtk'
class Singleton(object):