diff options
-rw-r--r-- | ranger/gui/displayable.py | 22 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/filelist.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/filelistcontainer.py | 8 | ||||
-rw-r--r-- | ranger/gui/widgets/notify.py | 5 | ||||
-rw-r--r-- | ranger/gui/widgets/pager.py | 7 | ||||
-rw-r--r-- | ranger/gui/widgets/process_manager.py | 16 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 7 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 7 |
9 files changed, 31 insertions, 47 deletions
diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index 442a7d35..f54a3fc7 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -18,8 +18,6 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): self.x = 0 self.y = 0 - self.absx = 0 - self.absy = 0 self.wid = 0 self.hei = 0 self.colorscheme = self.settings.colorscheme @@ -85,8 +83,8 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): Test whether the point (with absolute coordinates) lies within the boundaries of this object. """ - return (x >= self.absx and x < self.absx + self.wid) and \ - (y >= self.absy and y < self.absy + self.hei) + return (x >= self.x and x < self.x + self.wid) and \ + (y >= self.y and y < self.y + self.hei) def click(self, event): """Called when a mouse key is pressed and self.focused is True. @@ -155,7 +153,7 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): if hei != self.hei or wid != self.wid: try: - log("resizing " + self.__class__.__name__) +# log("resizing " + self.__class__.__name__) self.win.resize(hei, wid) except: # Not enough space for resizing... @@ -167,21 +165,19 @@ class Displayable(EnvironmentAware, FileManagerAware, SettingsAware): pass #raise OutOfBoundsException("Resizing Failed!") - if do_move or y != self.absy or x != self.absx: + self.hei, self.wid = self.win.getmaxyx() + + if do_move or y != self.y or x != self.x: log("moving " + self.__class__.__name__) try: self.win.mvderwin(y, x) except: pass - self.absy, self.absx = y, x + self.y, self.x = self.win.getparyx() if self.parent: - self.absy += self.parent.absy - self.absx += self.parent.absx - - self.y, self.x = self.win.getbegyx() - self.hei, self.wid = self.win.getmaxyx() - + self.y += self.parent.y + self.x += self.parent.x class DisplayableContainer(Displayable): container = None diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index ffabefcc..db92908b 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -48,8 +48,8 @@ class Console(Widget): def finalize(self): try: - self.fm.ui.win.move(self.absy, - self.absx + self.pos + len(self.prompt)) + self.fm.ui.win.move(self.y, + self.x + self.pos + len(self.prompt)) except: pass diff --git a/ranger/gui/widgets/filelist.py b/ranger/gui/widgets/filelist.py index f38b4bee..71ee4717 100644 --- a/ranger/gui/widgets/filelist.py +++ b/ranger/gui/widgets/filelist.py @@ -33,7 +33,7 @@ class FileList(Widget, DisplayableContainer): pass elif self.target.type is T_DIRECTORY: - index = self.scroll_begin + event.y - self.absy + index = self.scroll_begin + event.y - self.y if event.pressed(1): if not self.main_display: diff --git a/ranger/gui/widgets/filelistcontainer.py b/ranger/gui/widgets/filelistcontainer.py index c1c3c184..7b52a641 100644 --- a/ranger/gui/widgets/filelistcontainer.py +++ b/ranger/gui/widgets/filelistcontainer.py @@ -46,7 +46,7 @@ class FileListContainer(Widget, DisplayableContainer): def resize(self, y, x, hei, wid): """Resize all the filelists according to the given ratio""" DisplayableContainer.resize(self, y, x, hei, wid) - left = self.x + left = 0 cut_off_last = self.preview and not self.preview_available \ and self.stretch_ratios @@ -65,10 +65,10 @@ class FileListContainer(Widget, DisplayableContainer): wid = int(self.wid - left + 1) if i == last_i - 1: - self.pager.resize(self.y, left, hei, max(1, self.wid - left)) + self.pager.resize(0, left, hei, max(1, self.wid - left)) try: - self.container[i].resize(self.y, left, hei, max(1, wid-1)) + self.container[i].resize(0, left, hei, max(1, wid-1)) except KeyError: pass @@ -98,4 +98,4 @@ class FileListContainer(Widget, DisplayableContainer): has_preview = self.container[-2].has_preview() if self.preview_available != has_preview: self.preview_available = has_preview - self.resize(self.absy, self.absx, self.hei, self.wid) + self.resize(self.y, self.x, self.hei, self.wid) diff --git a/ranger/gui/widgets/notify.py b/ranger/gui/widgets/notify.py index ea35700f..e3f972ee 100644 --- a/ranger/gui/widgets/notify.py +++ b/ranger/gui/widgets/notify.py @@ -23,7 +23,6 @@ class Notify(Widget): def draw(self): import curses, socket, os - self.win.move(self.y, self.x) i = 0 for msg in self.textcontainer: @@ -31,10 +30,10 @@ class Notify(Widget): break how = msg.bad and 'bad' or 'good' - self.color_at(self.y + i, self.x, self.wid,\ + self.color_at(i, 0, self.wid,\ 'in_notify', 'background', how) self.color('in_notify', 'message', how) - self.win.addnstr(self.y + i, self.x, msg.text, self.wid) + self.win.addnstr(i, 0, msg.text, self.wid) i += 1 self.color_reset() diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index 2b8d73a4..7b55027c 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -37,12 +37,7 @@ class Pager(Widget): starty=self.scroll_begin, startx=self.startx) for line, i in zip(line_gen, range(self.hei)): - y, x = self.y + i, self.x - - try: - self.win.addstr(y, x, line) - except: - pass + self.addstr(i, 0, line) def move(self, relative=0, absolute=None): i = self.scroll_begin diff --git a/ranger/gui/widgets/process_manager.py b/ranger/gui/widgets/process_manager.py index f0954a9e..08f390b5 100644 --- a/ranger/gui/widgets/process_manager.py +++ b/ranger/gui/widgets/process_manager.py @@ -47,8 +47,8 @@ class ProcessManager(Widget, Accumulator): if self.hei <= 0: return - self.win.addnstr(self.y, self.x, "Process Manager", self.wid) - self.color_at(self.y, self.x, self.wid, base_clr, 'title') + self.addstr(0, 0, "Process Manager") + self.color_at(0, 0, self.wid, base_clr, 'title') if lst: for i in range(self.hei - 1): @@ -57,21 +57,21 @@ class ProcessManager(Widget, Accumulator): obj = lst[i] except IndexError: break - y, x = self.y + i + 1, self.x + + y = i + 1 clr = deque(base_clr) if self.pointer == i: clr.append('selected') descr = obj.get_description() - self.win.addnstr(y, x, descr, self.wid) - self.color_at(y, x, self.wid, clr) + self.addstr(y, 0, descr, self.wid) + self.color_at(y, 0, self.wid, clr) else: if self.hei > 1: - self.win.addnstr(self.y + 1, self.x,\ - "No processes running", self.wid) - self.color_at(self.y + 1, self.x, self.wid, base_clr, 'error') + self.addstr(1, 0, "No processes running") + self.color_at(1, 0, self.wid, base_clr, 'error') self.color_reset() diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 4cfbea7b..81616c82 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -194,10 +194,7 @@ class StatusBar(Widget): def _print_result(self, result): import _curses - self.win.move(self.y, self.x) + self.win.move(0, 0) for part in result: self.color('in_statusbar', *part[0]) - try: - self.win.addstr(part[1]) - except _curses.error: - pass + self.addstr(part[1]) diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index f3377d08..09870f34 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -60,13 +60,10 @@ class TitleBar(Widget): def _print_result(self, result): import _curses - self.win.move(self.y, self.x) + self.win.move(0, 0) for part in result: self.color(*part.lst) - try: - self.win.addstr(part.string) - except _curses.error: - pass + self.addstr(part.string) self.color_reset() |