Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Update font size and geometry after terminal has finished loading #52

Merged
merged 2 commits into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion spyder_terminal/server/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var term,
pid,
charWidth,
charHeight,
path;
path,
curFont;

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
Expand Down Expand Up @@ -97,6 +98,7 @@ function setFont(font) {
}

function fitFont(font) {
curFont = font;
setFont(font);
setFont('ubuntu-powerline');
setFont(font);
Expand Down Expand Up @@ -133,4 +135,5 @@ function runRealTerminal() {
term.writeln("Loading...");
chdir(path);
clearTerm();
fitFont(curFont);
}
17 changes: 10 additions & 7 deletions spyder_terminal/tests/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
LOCATION = os.path.realpath(os.path.join(os.getcwd(),
os.path.dirname(__file__)))

TERM_UP = 15000
TERM_UP = 20000


def check_pwd(termwidget):
Expand Down Expand Up @@ -86,16 +86,19 @@ def test_new_terminal(qtbot):
assert status_code == 200

# Move to LOCATION
qtbot.keyClicks(term.view, 'cd {}'.format(LOCATION))
qtbot.keyPress(term.view, Qt.Key_Return)
# qtbot.keyClicks(term.view, 'cd {}'.format(LOCATION))
# qtbot.keyPress(term.view, Qt.Key_Return)
term.exec_cmd('cd {}'.format(LOCATION))

# Clear
qtbot.keyClicks(term.view, 'clear')
qtbot.keyPress(term.view, Qt.Key_Return)
# qtbot.keyClicks(term.view, 'clear')
# qtbot.keyPress(term.view, Qt.Key_Return)
term.exec_cmd('clear')

# Run pwd
qtbot.keyClicks(term.view, 'pwd')
qtbot.keyPress(term.view, Qt.Key_Return)
# qtbot.keyClicks(term.view, 'pwd')
# qtbot.keyPress(term.view, Qt.Key_Return)
term.exec_cmd('pwd')

# Assert pwd is LOCATION
qtbot.waitUntil(lambda: check_pwd(term), timeout=TERM_UP)
Expand Down
4 changes: 4 additions & 0 deletions spyder_terminal/widgets/terminalgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def get_fonts(self):
"""List terminal CSS fonts."""
return self.eval_javascript("$('.terminal').css('font-family')")

def exec_cmd(self, cmd):
"""Execute a command inside the terminal."""
self.eval_javascript('exec("{0}")'.format(cmd))


class TermView(WebView):
"""XTerm Wrapper."""
Expand Down