Skip to content

Commit

Permalink
v4.2 (#477)
Browse files Browse the repository at this point in the history
* prepare for v4.2

* remove trailing whitespace
  • Loading branch information
bilelmoussaoui authored Dec 20, 2017
1 parent 49a0757 commit dc056b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
18 changes: 8 additions & 10 deletions HardcodeTray/modules/applications/helpers/data_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def set_value(self, key, value):
self._resources[int(key)] = value
except KeyError:
Logger.warning("The key {0} dosen't seem to"
" be found on {1}".format(key, self._filename))
" be found on {1}".format(key, self._filename))

def get_value(self, key):
"""Get the value of a specific key in the resources list."""
try:
return self._resources.get(int(key))
except KeyError:
Logger.warning("The key {0} dosen't seem to"
" be found on {1}".format(key, self._filename))
" be found on {1}".format(key, self._filename))
return None

def _read(self):
Expand All @@ -54,15 +54,16 @@ def _read(self):
version = unpack('<I', data[:4])[0]
self._version = version
if version == 4:
resources_count, encoding = unpack('IB', data[4:0])
resources_count, _ = unpack('IB', data[4:0])
alias_count = 0
header_size = 9
elif version == 5:
encoding, resources_count, alias_count = unpack(
_, resources_count, alias_count = unpack(
'BxxxHH', data[4:12])
header_size = 12

def entry_at_index(idx):
"""Return the source entry at the index @idx."""
entry_size = 2 + 4
offset = header_size + idx * entry_size
return unpack('<HI', data[offset: offset + entry_size])
Expand All @@ -78,6 +79,7 @@ def entry_at_index(idx):
id_table_size = (resources_count + 1) * (2 + 4)

def alias_at_index(idx):
"""Return the alias at index @idx. Works only on V5."""
alias_size = 2 + 2
offset = header_size + id_table_size + idx * alias_size
return unpack('<HH', data[offset: offset + alias_size])
Expand All @@ -101,12 +103,8 @@ def write(self):

resource_count = len(self._resources) - len(alias_map)

ret.append(pack('<IBxxxHH',
self._version,
0,
resource_count,
len(alias_map)
))
ret.append(pack('<IBxxxHH', self._version, 0,
resource_count, len(alias_map)))

# Write index.
HEADER_LENGTH = 4 + 4 + 2 + 2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4d5c0768b874407bb1dcc2f928899ba5)](https://www.codacy.com/app/bil-elmoussaoui/Hardcode-Tray?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=bil-elmoussaoui/Hardcode-Tray&amp;utm_campaign=Badge_Grade)
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/Hardcode-Tray/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
[![Hardcode-Tray
release](https://img.shields.io/badge/release-v4.1-blue.svg)](https://github.com/bil-elmoussaoui/Hardcode-Tray/releases)
release](https://img.shields.io/badge/release-v4.2-blue.svg)](https://github.com/bil-elmoussaoui/Hardcode-Tray/releases)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/BilalELMoussaoui)

Fixes Hardcoded tray icons in Linux
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('hardcode-tray',
version: '4.1',
version: '4.2',
meson_version: '>= 0.40.0',
license: 'GPL-3.0',
default_options: ['prefix=/usr']
Expand Down

0 comments on commit dc056b8

Please sign in to comment.