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
Snippets
Deploy
Releases
Container Registry
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
Show more breadcrumbs
Santiago
sakia
Commits
5a49a318
Commit
5a49a318
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Added default account feature
Added the possibility to define a default account
parent
cf7d3423
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
res/ui/mainwindow.ui
+27
-4
27 additions, 4 deletions
res/ui/mainwindow.ui
src/cutecoin/core/app.py
+13
-3
13 additions, 3 deletions
src/cutecoin/core/app.py
src/cutecoin/gui/mainwindow.py
+9
-0
9 additions, 0 deletions
src/cutecoin/gui/mainwindow.py
with
49 additions
and
7 deletions
res/ui/mainwindow.ui
+
27
−
4
View file @
5a49a318
...
...
@@ -42,12 +42,13 @@
</property>
<widget
class=
"QMenu"
name=
"menu_change_account"
>
<property
name=
"title"
>
<string>
Open
account
</string>
<string>
Open
</string>
</property>
</widget>
<addaction
name=
"menu_change_account"
/>
<addaction
name=
"action_add_account"
/>
<addaction
name=
"menu_change_account"
/>
<addaction
name=
"action_configure_parameters"
/>
<addaction
name=
"action_set_as_default"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_export"
/>
<addaction
name=
"action_import"
/>
...
...
@@ -127,7 +128,7 @@
</action>
<action
name=
"action_add_account"
>
<property
name=
"text"
>
<string>
Add
account
</string>
<string>
Add
</string>
</property>
</action>
<action
name=
"action_save"
>
...
...
@@ -152,7 +153,7 @@
</action>
<action
name=
"action_configure_parameters"
>
<property
name=
"text"
>
<string>
Configure
account
</string>
<string>
Configure
</string>
</property>
</action>
<action
name=
"action_import"
>
...
...
@@ -170,6 +171,11 @@
<string>
Certification
</string>
</property>
</action>
<action
name=
"action_set_as_default"
>
<property
name=
"text"
>
<string>
Set as default
</string>
</property>
</action>
</widget>
<resources/>
<connections>
...
...
@@ -301,6 +307,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>
action_set_as_default
</sender>
<signal>
triggered()
</signal>
<receiver>
MainWindow
</receiver>
<slot>
set_as_default_account()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
-1
</x>
<y>
-1
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
340
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>
open_add_account_dialog()
</slot>
...
...
@@ -312,5 +334,6 @@
<slot>
refresh_wallet_content(QModelIndex)
</slot>
<slot>
export_account()
</slot>
<slot>
open_certification_dialog()
</slot>
<slot>
set_as_default_account()
</slot>
</slots>
</ui>
This diff is collapsed.
Click to expand it.
src/cutecoin/core/app.py
+
13
−
3
View file @
5a49a318
...
...
@@ -26,14 +26,20 @@ class Application(object):
Constructor
'''
self
.
accounts
=
{}
self
.
default_account
=
""
self
.
current_account
=
None
config
.
parse_arguments
(
argv
)
self
.
load
()
if
self
.
default_account
!=
""
:
self
.
current_account
=
self
.
get_account
(
self
.
default_account
)
def
get_account
(
self
,
name
):
if
not
self
.
accounts
[
name
]:
self
.
load_account
(
name
)
return
self
.
accounts
[
name
]
if
name
in
self
.
accounts
.
keys
():
return
self
.
accounts
[
name
]
else
:
return
None
def
create_account
(
self
,
name
):
for
a
in
self
.
accounts
:
...
...
@@ -72,6 +78,8 @@ class Application(object):
with
open
(
config
.
parameters
[
'
data
'
],
'
r
'
)
as
json_data
:
data
=
json
.
load
(
json_data
)
json_data
.
close
()
if
'
default_account
'
in
data
.
keys
():
self
.
default_account
=
data
[
'
default_account
'
]
for
account_name
in
data
[
'
local_accounts
'
]:
self
.
accounts
[
account_name
]
=
None
...
...
@@ -141,10 +149,12 @@ class Application(object):
def
jsonify_accounts
(
self
):
data
=
[]
logging
.
debug
(
"
{0}
"
.
format
(
self
.
accounts
))
for
account
in
self
.
accounts
:
data
.
append
(
account
.
name
)
data
.
append
(
account
)
return
data
def
jsonify
(
self
):
data
=
{
'
local_accounts
'
:
self
.
jsonify_accounts
()}
data
=
{
'
default_account
'
:
self
.
default_account
,
'
local_accounts
'
:
self
.
jsonify_accounts
()}
return
data
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/mainwindow.py
+
9
−
0
View file @
5a49a318
...
...
@@ -15,6 +15,7 @@ from .import_account import ImportAccountDialog
from
.certification
import
CertificationDialog
from
.password_asker
import
PasswordAskerDialog
import
logging
class
MainWindow
(
QMainWindow
,
Ui_MainWindow
):
...
...
@@ -69,6 +70,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
currency_tab
=
self
.
currencies_tabwidget
.
currentWidget
()
currency_tab
.
refresh_wallets
()
def
set_as_default_account
(
self
):
self
.
app
.
default_account
=
self
.
app
.
current_account
.
name
logging
.
debug
(
self
.
app
.
current_account
)
self
.
app
.
save
(
self
.
app
.
current_account
)
self
.
action_set_as_default
.
setEnabled
(
False
)
'''
Refresh main window
When the selected account changes, all the widgets
...
...
@@ -89,7 +96,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if
self
.
app
.
current_account
is
None
:
self
.
menu_contacts
.
setEnabled
(
False
)
self
.
menu_actions
.
setEnabled
(
False
)
self
.
action_set_as_default
.
setEnabled
(
False
)
else
:
self
.
action_set_as_default
.
setEnabled
(
self
.
app
.
current_account
.
name
!=
self
.
app
.
default_account
)
self
.
password_asker
=
PasswordAskerDialog
(
self
.
app
.
current_account
)
self
.
menu_contacts
.
setEnabled
(
True
)
self
.
menu_actions
.
setEnabled
(
True
)
...
...
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