Commit 56cc5d40 authored by Falk Alexander Seidl's avatar Falk Alexander Seidl

Added icon handling

parent 5f585915
......@@ -15,6 +15,14 @@
background: transparent;
}
#GroupRow, #EntryRow {
box-shadow: 0px 1px 0px alpha(currentColor,0.1) inset;
}
#entry_subtitle_label {
color: alpha(currentColor,0.5);
}
.PathbarButtonActive {
box-shadow: none;
transition-property: none;
......@@ -38,3 +46,4 @@
min-width: 10px;
padding: 2px 5px 1px;
}
......@@ -67,6 +67,15 @@ class DatabaseManager:
entry = self.db.find_entries(uuid=uuid, first=True)
return entry.title
# Return the belonging icon for an entry object
def get_entry_icon_from_entry_object(self, entry):
return entry.icon
# Return entry icon from entry uuid
def get_entry_icon_from_entry_uuid(self, uuid):
entry = self.db.find_entries(uuid=uuid, first=True)
return entry.icon
# Return the belonging username for an entry object
def get_entry_username_from_entry_object(self, entry):
return entry.username
......
from gi.repository import Gtk
import gi
import keepassgtk.icon
gi.require_version('Gtk', '3.0')
class EntryRow(Gtk.ListBoxRow):
database_manager = NotImplemented
entry_uuid = NotImplemented
icon = NotImplemented
label = NotImplemented
password = NotImplemented
type = "EntryRow"
def __init__(self, dbm, entry):
Gtk.ListBoxRow.__init__(self)
self.set_name("EntryRow")
self.database_manager = dbm
self.entry_uuid = dbm.get_entry_uuid_from_entry_object(entry)
self.icon = dbm.get_entry_icon_from_entry_object(entry)
self.label = dbm.get_entry_name_from_entry_object(entry)
self.password = dbm.get_entry_password_from_entry_object(entry)
......@@ -26,10 +31,14 @@ class EntryRow(Gtk.ListBoxRow):
"/run/terminal/KeepassGtk/unlocked_database.ui")
entry_box = builder.get_object("entry_box")
entry_icon = builder.get_object("entry_icon")
entry_name_label = builder.get_object("entry_name_label")
entry_subtitle_label = builder.get_object("entry_subtitle_label")
entry_password_input = builder.get_object("entry_password_input")
# Icon
entry_icon.set_from_icon_name(keepassgtk.icon.get_icon(self.icon), 20)
# Title/Name
if self.label is not None:
entry_name_label.set_text(self.label)
......
......@@ -10,6 +10,7 @@ class GroupRow(Gtk.ListBoxRow):
def __init__(self, dbm, group):
Gtk.ListBoxRow.__init__(self)
self.set_name("GroupRow")
self.group_uuid = dbm.get_group_uuid_from_group_object(group)
self.label = dbm.get_group_name_from_group_object(group)
......
icon_list = {"0" : "dialog-password-symbolic",
"1" : "network-wired-symbolic",
"2" : "dialog-warning-symbolic",
"3" : "network-server-symbolic",
"4" : "document-edit-symbolic",
"5" : "media-view-subtitles-symbolic",
"6" : "application-x-addon-symbolic",
"7" : "accessories-text-editor-symbolic",
"8" : "network-wired-symbolic",
"9" : "mail-send-symbolic",
"10" : "text-x-generic-symbolic",
"11" : "camera-photo-symbolic",
"12" : "network-wireless-signal-excellent-symbolic",
"13" : "dialog-password-symbolic",
"14" : "colorimeter-colorhug-symbolic",
"15" : "scanner-symbolic",
"16" : "network-wired-symbolic",
"17" : "media-optical-cd-audio-symbolic",
"18" : "video-display-symbolic",
"19" : "mail-unread-symbolic",
"20" : "emblem-system-symbolic",
"21" : "edit-paste-symbolic",
"22" : "edit-paste-symbolic",
"23" : "preferences-desktop-remote-desktop-symbolic",
"24" : "uninterruptible-power-supply-symbolic",
"25" : "mail-unread-symbolic",
"26" : "media-floppy-symbolic",
"27" : "drive-harddisk-symbolic",
"28" : "dialog-password-symbolic",
"29" : "dialog-password-symbolic",
"30" : "utilities-terminal-symbolic",
"31" : "printer-symbolic",
"32" : "image-x-generic-symbolic",
"33" : "edit-select-all-symbolic",
"34" : "preferences-system-symbolic",
"35" : "network-workgroup-symbolic",
"36" : "dialog-password-symbolic",
"37" : "dialog-password-symbolic",
"38" : "drive-harddisk-symbolic",
"39" : "document-open-recent-symbolic",
"40" : "system-search-symbolic",
"41" : "dialog-password-symbolic",
"42" : "media-flash-symbolic",
"43" : "user-trash-symbolic",
"44" : "accessories-text-editor-symbolic",
"45" : "edit-delete-symbolic",
"46" : "dialog-question-symbolic",
"47" : "package-x-generic-symbolic",
"48" : "folder-symbolic",
"49" : "folder-open-symbolic",
"50" : "document-open-symbolic",
"51" : "system-lock-screen-symbolic",
"52" : "rotation-locked-symbolic",
"53" : "object-select-symbolic",
"54" : "document-edit-symbolic",
"55" : "image-x-generic-symbolic",
"56" : "accessories-dictionary-symbolic",
"57" : "view-list-symbolic",
"58" : "avatar-default-symbolic",
"59" : "applications-engineering-symbolic",
"60" : "go-home-symbolic",
"61" : "starred-symbolic",
"62" : "start-here-symbolic",
"63" : "dialog-password-symbolic",
"64" : "start-here-symbolic",
"65" : "accessories-dictionary-symbolic",
"66" : "dialog-password-symbolic",
"67" : "application-certificate-symbolic",
"68" : "phone-apple-iphone-symbolic" }
def get_icon(number):
return icon_list[number]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment