Skip to content

Commit

Permalink
Merge 71c0a7d into ee0d89b
Browse files Browse the repository at this point in the history
  • Loading branch information
jyeray committed May 15, 2018
2 parents ee0d89b + 71c0a7d commit e1db6e8
Show file tree
Hide file tree
Showing 41 changed files with 734 additions and 518 deletions.
7 changes: 7 additions & 0 deletions TECHNICALDEBT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Keyboard rewrite tecnichal debt**
============================

**This file contains keep technical debt that should be fixed before finishing the project.**


- [ ] ```require_relative``` are being used temporary, for example in ```y2_keyboard/clients/keyboard.rb```, it must be replaced with ```require```.
3 changes: 1 addition & 2 deletions console/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ scrconf_DATA = \
scrconf/sysconfig_console.scr

ydata_DATA = \
data/consolefonts.ycp \
data/consolefonts_opensuse.ycp
data/consolefonts.ycp

EXTRA_DIST = $(module_DATA) $(scrconf_DATA) $(ydata_DATA)

Expand Down
115 changes: 27 additions & 88 deletions console/src/data/consolefonts.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -14,98 +14,45 @@
/*
* Maintainer: Thomas Fehr <fehr@suse.de>
*
* default consolefonts map
* consolefonts map
*/

$[
// LANG font unicode map screen map, console magic
"en_GB@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"en_GB" : [ "lat1-16.psfu", "", "none", "(B" ],
"en_US" : [ "lat1-16.psfu", "", "none", "(B" ],
"en" : [ "lat1-16.psfu", "", "none", "(B" ],
"en_US.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"en_GB.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"de_DE@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ],
"de_DE" : [ "lat1-16.psfu", "", "none", "(B" ],
"de_CH" : [ "lat1-16.psfu", "", "none", "(B" ],
"de" : [ "lat1-16.psfu", "", "none", "(B" ],
"de_DE.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"de_CH.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"de_AT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"fr_FR@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ],
"fr_FR" : [ "lat1-16.psfu", "", "none", "(B" ],
"fr_CH" : [ "lat1-16.psfu", "", "none", "(B" ],
"fr" : [ "lat1-16.psfu", "", "none", "(B" ],
"fr_FR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"it_IT@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"it_IT" : [ "lat1-16.psfu", "", "none", "(B" ],
"it" : [ "lat1-16.psfu", "", "none", "(B" ],
"it_IT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"es_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ],
"es_ES" : [ "lat1-16.psfu", "", "none", "(B" ],
"es" : [ "lat1-16.psfu", "", "none", "(B" ],
"es_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"nl_NL@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"nl_NL" : [ "lat1-16.psfu", "", "none", "(B" ],
"nl" : [ "lat1-16.psfu", "", "none", "(B" ],
"nl_NL.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"pt_PT@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"pt_PT" : [ "lat1-16.psfu", "", "none", "(B" ],
"pt_BR" : [ "lat1-16.psfu", "", "trivial", "(B" ],
"pt" : [ "lat1-16.psfu", "", "none", "(B" ],
"pt_PT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"pt_BR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"ca_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"ca_ES" : [ "lat1-16.psfu", "", "none", "(B" ],
"ca" : [ "lat1-16.psfu", "", "none", "(B" ],
"ca_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"gl_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"gl_ES" : [ "lat1-16.psfu", "", "none", "(B" ],
"gl" : [ "lat1-16.psfu", "", "none", "(B" ],
"gl_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"br_FR@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"br_FR" : [ "lat1-16.psfu", "", "none", "(B" ],
"br" : [ "lat1-16.psfu", "", "none", "(B" ],
"br_FR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"en" : [ "eurlatgr.psfu", "", "none", "" ],
// The two-letters language is used as a fallback, so additional entries like
// the ones displayed below are not needed as long as they use the same values.
// "en_GB@euro" : [ "eurlatgr.psfu", "", "none", "" ],
// "en_GB" : [ "eurlatgr.psfu", "", "none", "" ],
// "en_US" : [ "eurlatgr.psfu", "", "none", "" ],
// "en_US.UTF-8" : [ "eurlatgr.psfu", "", "none", "" ],
// "en_GB.UTF-8" : [ "eurlatgr.psfu", "", "none", "" ],
"de" : [ "eurlatgr.psfu", "", "none", "" ],
"fr" : [ "eurlatgr.psfu", "", "none", "" ],
"it" : [ "eurlatgr.psfu", "", "none", "" ],
"es" : [ "eurlatgr.psfu", "", "none", "" ],
"nl" : [ "eurlatgr.psfu", "", "none", "" ],
"pt" : [ "eurlatgr.psfu", "", "none", "" ],
"ca" : [ "eurlatgr.psfu", "", "none", "" ],
"gl" : [ "eurlatgr.psfu", "", "none", "" ],
"br" : [ "eurlatgr.psfu", "", "none", "" ],
"pl" : [ "eurlatgr.psfu", "", "none", "" ],
"cs" : [ "eurlatgr.psfu", "", "none", "" ],
"sk" : [ "eurlatgr.psfu", "", "none", "" ],
"hu" : [ "eurlatgr.psfu", "", "none", "" ],
"lt" : [ "eurlatgr.psfu", "", "none", "" ],
"ja" : [ "eurlatgr.psfu", "", "none", "" ],
"tr" : [ "eurlatgr.psfu", "", "none", "" ],

"el_GR" : [ "iso07u-16.psfu", "", "trivial", "(K" ],
"el" : [ "iso07u-16.psfu", "", "trivial", "(K" ],
"el_GR.UTF-8" : [ "iso07u-16.psfu", "", "trivial", "(K" ],

"pl_PL" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"pl" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"pl_PL.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ],

"cs_CZ" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"cs" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"cs_CZ.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ],

"sk_SK" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"sk" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"sk_SK.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ],

"hu_HU" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"hu" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"hu_HU.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ],

"lt_LT" : [ "lat4a-16.psfu", "", "8859-13", "(K" ],
"lt" : [ "lat4a-16.psfu", "", "8859-13", "(K" ],
"lt_LT.UTF-8" : [ "lat4a-16.psfu", "", "8859-13", "(K" ],

"ru_RU.KOI8-R" : [ "UniCyr_8x16.psf", "", "koi2alt", "(K" ],
"ru" : [ "UniCyr_8x16.psf", "", "koi2alt", "(K" ],
"ru_RU.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ],

"sr_RS@latin" : [ "lat2-16.psfu", "", "8859-2", "(K" ],
"sr_RS@latin" : [ "eurlatgr.psfu", "", "trivial", "" ],
"sr" : [ "UniCyr_8x16.psf", "", "trivial", "(K" ],
"sr_RS.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ],

Expand All @@ -117,13 +64,5 @@ $[

"bg_BG" : [ "UniCyr_8x16.psf", "", "trivial", "(K" ],
"bg" : [ "UniCyr_8x16.psf", "", "trivial", "(K" ],
"bg_BG.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ],

"ja_JP.sjis" : [ "lat9w-16.psfu", "", "trivial", "(K" ],
"ja" : [ "lat1-16.psfu", "", "none", "(K" ],
"ja_JP.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ],

"tr_TR" : [ "iso09.f16n", "", "none", "(K" ],
"tr" : [ "iso09.f16n", "", "none", "(K" ],
"tr_TR.UTF-8" : [ "iso09.f16n", "", "trivial", "(K" ]
"bg_BG.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ]
]
68 changes: 0 additions & 68 deletions console/src/data/consolefonts_opensuse.ycp

This file was deleted.

27 changes: 12 additions & 15 deletions console/src/modules/Console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ def SelectFont(lang)
# save data to system (rc.config agent)

def Save
SCR.Write(path(".sysconfig.console.CONSOLE_FONT"), @font)
SCR.Write(path(".sysconfig.console.CONSOLE_SCREENMAP"), @screenMap)
SCR.Write(path(".sysconfig.console.CONSOLE_UNICODEMAP"), @unicodeMap)
# writing vconsole.conf directly, no other API available ATM
SCR.Write(path(".etc.vconsole_conf.FONT"), @font)
SCR.Write(path(".etc.vconsole_conf.FONT_MAP"), @screenMap)
SCR.Write(path(".etc.vconsole_conf.FONT_UNIMAP"), @unicodeMap)
SCR.Write(path(".etc.vconsole_conf"), nil)

SCR.Write(path(".sysconfig.console.CONSOLE_MAGIC"), @magic)

SCR.Write(path(".sysconfig.console.CONSOLE_ENCODING"), WFM.GetEncoding)
Expand Down Expand Up @@ -184,21 +187,15 @@ def Save
# restore data to system (rc.config agent)
# returns encoding
def Restore
@font = Convert.to_string(
SCR.Read(path(".sysconfig.console.CONSOLE_FONT"))
)
@screenMap = Convert.to_string(
SCR.Read(path(".sysconfig.console.CONSOLE_SCREENMAP"))
)
@unicodeMap = Convert.to_string(
SCR.Read(path(".sysconfig.console.CONSOLE_UNICODEMAP"))
)
@font = Misc.SysconfigRead(path(".etc.vconsole_conf.FONT"), "")
@screenMap = Misc.SysconfigRead(path(".etc.vconsole_conf.FONT_MAP"), "")
@unicodeMap = Misc.SysconfigRead(path(".etc.vconsole_conf.FONT_UNIMAP"), "")
Builtins.y2milestone("vconsole.conf: FONT: %1, FONT_MAP: %2, FONT_UNIMAP: %3", @font, @screenMap, @unicodeMap)

@magic = Convert.to_string(
SCR.Read(path(".sysconfig.console.CONSOLE_MAGIC"))
)
@language = Convert.to_string(
SCR.Read(path(".sysconfig.language.RC_LANG"))
)
@language = Language.GetCurrentLocaleString
Builtins.y2milestone("encoding %1", Encoding.console)
Encoding.console
end
Expand Down
26 changes: 15 additions & 11 deletions console/test/console_test.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/usr/bin/env rspec

require_relative "test_helper"
require "y2country/language_dbus"

Yast.import "Console"

describe Yast::Console do
subject(:console) { Yast::Console }
describe "Yast::Console" do
subject(:console) { "Yast::Console" }

before { console.main }
before do
allow(Y2Country).to receive(:read_locale_conf).and_return(nil)
Yast.import "Console"
Yast::Console.main
end

describe "#SelectFont" do
let(:braille) { false }
Expand All @@ -22,22 +26,22 @@

it "sets console fonts for the given language" do
expect(Yast::UI).to receive(:SetConsoleFont)
.with("(K", "lat9w-16.psfu", "trivial", "", "es_ES")
console.SelectFont(language)
.with("", "eurlatgr.psfu", "none", "", "es_ES")
Yast::Console.SelectFont(language)
end

it "returns the encoding" do
expect(console.SelectFont(language)).to eq("ISO-8859-1")
expect(Yast::Console.SelectFont(language)).to eq("ISO-8859-1")
end

context "when no console font is available" do
it "does not set the console font" do
expect(Yast::UI).to_not receive(:SetConsole)
console.SelectFont("martian")
Yast::Console.SelectFont("martian")
end

it "returns the encoding" do
expect(console.SelectFont(language)).to eq("ISO-8859-1")
expect(Yast::Console.SelectFont(language)).to eq("ISO-8859-1")
end
end

Expand All @@ -47,7 +51,7 @@
it "sets console fonts for the given language" do
expect(Yast::UI).to receive(:SetConsoleFont)
.with("", "eurlatgr.psfu", "none", "", "es_ES")
console.SelectFont(language)
Yast::Console.SelectFont(language)
end
end

Expand All @@ -57,7 +61,7 @@
it "runs /usr/bin/setfont" do
expect(Yast::SCR).to receive(:Execute)
.with(Yast::Path.new(".target.bash"), "/usr/bin/setfont")
console.SelectFont(language)
Yast::Console.SelectFont(language)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions keyboard/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
# Makefile.am for country/keyboard
SUBDIRS = src
# TODO: test dir is not included as it is failing during obs build

3 changes: 0 additions & 3 deletions keyboard/src/data/keyboard_raw.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
*
* description of i.g.$[ "pc104": $[ "ncurses": "us.map.gz" ]
*
* Added "compose" tag for COMPOSETABLE flag in rc.config
* non-latin1 keyboards need this, see bug #7023
*
*/
{
textdomain "country";
Expand Down
3 changes: 0 additions & 3 deletions keyboard/src/data/keyboard_raw_opensuse.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
*
* description of i.g.$[ "pc104": $[ "ncurses": "us.map.gz" ]
*
* Added "compose" tag for COMPOSETABLE flag in rc.config
* non-latin1 keyboards need this, see bug #7023
*
*/
{
textdomain "country";
Expand Down

0 comments on commit e1db6e8

Please sign in to comment.