Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
e91c3fdb
Commit
e91c3fdb
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Load account "just in time"
parent
1fa87422
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/core/app.py
+16
-15
16 additions, 15 deletions
src/cutecoin/core/app.py
src/cutecoin/gui/mainwindow.py
+3
-3
3 additions, 3 deletions
src/cutecoin/gui/mainwindow.py
with
19 additions
and
18 deletions
src/cutecoin/core/app.py
+
16
−
15
View file @
e91c3fdb
...
@@ -25,16 +25,15 @@ class Application(object):
...
@@ -25,16 +25,15 @@ class Application(object):
'''
'''
Constructor
Constructor
'''
'''
self
.
accounts
=
[]
self
.
accounts
=
{}
self
.
current_account
=
None
self
.
current_account
=
None
config
.
parse_arguments
(
argv
)
config
.
parse_arguments
(
argv
)
self
.
load
()
self
.
load
()
def
get_account
(
self
,
name
):
def
get_account
(
self
,
name
):
for
a
in
self
.
accounts
:
if
not
self
.
accounts
[
name
]:
logging
.
debug
(
'
Name :
'
+
a
.
name
+
'
/
'
+
name
)
self
.
load_account
(
name
)
if
name
==
a
.
name
:
return
self
.
accounts
[
name
]
return
a
def
create_account
(
self
,
name
):
def
create_account
(
self
,
name
):
for
a
in
self
.
accounts
:
for
a
in
self
.
accounts
:
...
@@ -70,17 +69,19 @@ class Application(object):
...
@@ -70,17 +69,19 @@ class Application(object):
if
(
os
.
path
.
exists
(
config
.
parameters
[
'
data
'
])
if
(
os
.
path
.
exists
(
config
.
parameters
[
'
data
'
])
and
os
.
path
.
isfile
(
config
.
parameters
[
'
data
'
])):
and
os
.
path
.
isfile
(
config
.
parameters
[
'
data
'
])):
logging
.
debug
(
"
Loading data...
"
)
logging
.
debug
(
"
Loading data...
"
)
json_data
=
open
(
config
.
parameters
[
'
data
'
],
'
r
'
)
with
open
(
config
.
parameters
[
'
data
'
],
'
r
'
)
as
json_data
:
data
=
json
.
load
(
json_data
)
json_data
.
close
()
for
account_name
in
data
[
'
local_accounts
'
]:
account_path
=
os
.
path
.
join
(
config
.
parameters
[
'
home
'
],
account_name
,
'
properties
'
)
json_data
=
open
(
account_path
,
'
r
'
)
data
=
json
.
load
(
json_data
)
data
=
json
.
load
(
json_data
)
account
=
Account
.
load
(
data
)
json_data
.
close
()
self
.
accounts
.
append
(
account
)
for
account_name
in
data
[
'
local_accounts
'
]:
self
.
accounts
[
account_name
]
=
None
def
load_account
(
self
,
account_name
):
account_path
=
os
.
path
.
join
(
config
.
parameters
[
'
home
'
],
account_name
,
'
properties
'
)
with
open
(
account_path
,
'
r
'
)
as
json_data
:
data
=
json
.
load
(
json_data
)
account
=
Account
.
load
(
data
)
self
.
accounts
[
account_name
]
=
account
def
load_cache
(
self
,
account
):
def
load_cache
(
self
,
account
):
for
wallet
in
account
.
wallets
:
for
wallet
in
account
.
wallets
:
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/mainwindow.py
+
3
−
3
View file @
e91c3fdb
...
@@ -77,10 +77,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
...
@@ -77,10 +77,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self
.
menu_change_account
.
clear
()
self
.
menu_change_account
.
clear
()
signal_mapper
=
QSignalMapper
(
self
)
signal_mapper
=
QSignalMapper
(
self
)
for
account
in
self
.
app
.
accounts
:
for
account
_name
in
self
.
app
.
accounts
.
keys
()
:
action
=
QAction
(
account
.
name
,
self
)
action
=
QAction
(
account
_
name
,
self
)
self
.
menu_change_account
.
addAction
(
action
)
self
.
menu_change_account
.
addAction
(
action
)
signal_mapper
.
setMapping
(
action
,
account
.
name
)
signal_mapper
.
setMapping
(
action
,
account
_
name
)
action
.
triggered
.
connect
(
signal_mapper
.
map
)
action
.
triggered
.
connect
(
signal_mapper
.
map
)
signal_mapper
.
mapped
[
str
].
connect
(
self
.
action_change_account
)
signal_mapper
.
mapped
[
str
].
connect
(
self
.
action_change_account
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment