Setup url path field for keypress and path updates
This commit is contained in:
parent
b302465322
commit
95c93db701
|
@ -206,7 +206,6 @@
|
|||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-right">45</property>
|
||||
<property name="spacing">5</property>
|
||||
<property name="layout-style">start</property>
|
||||
<child>
|
||||
|
@ -280,6 +279,22 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes"> </property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="focus-on-click">False</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="double-buffered">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -344,10 +359,12 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="path_entry">
|
||||
<property name="name">path_entry</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text" translatable="yes">Path...</property>
|
||||
<property name="placeholder-text" translatable="yes">Path...</property>
|
||||
<signal name="key-release-event" handler="do_action_from_bar_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -404,6 +421,7 @@
|
|||
<property name="margin-right">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="show-border">False</property>
|
||||
<property name="scrollable">True</property>
|
||||
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
||||
<child>
|
||||
|
@ -439,6 +457,7 @@
|
|||
<property name="margin-right">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="show-border">False</property>
|
||||
<property name="scrollable">True</property>
|
||||
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
||||
<child>
|
||||
|
@ -488,6 +507,7 @@
|
|||
<property name="margin-right">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="show-border">False</property>
|
||||
<property name="scrollable">True</property>
|
||||
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
||||
<child>
|
||||
|
@ -522,6 +542,7 @@
|
|||
<property name="margin-right">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="show-border">False</property>
|
||||
<property name="scrollable">True</property>
|
||||
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
||||
<child>
|
||||
|
|
|
@ -31,13 +31,25 @@ class Path:
|
|||
|
||||
|
||||
def set_path(self, path):
|
||||
self.path = list( filter(None, path.replace("\\", "/").split('/')) )
|
||||
self.load_directory()
|
||||
if path == self.get_path():
|
||||
return
|
||||
|
||||
if os.path.isdir(path):
|
||||
self.path = list( filter(None, path.replace("\\", "/").split('/')) )
|
||||
self.load_directory()
|
||||
return True
|
||||
return False
|
||||
|
||||
def set_path_with_sub_path(self, sub_path):
|
||||
path = os.path.join(self.get_home(), sub_path)
|
||||
self.path = list( filter(None, path.replace("\\", "/").split('/')) )
|
||||
self.load_directory()
|
||||
path = os.path.join(self.get_home(), sub_path)
|
||||
if path == self.get_path():
|
||||
return
|
||||
|
||||
if os.path.isdir(path):
|
||||
self.path = list( filter(None, path.replace("\\", "/").split('/')) )
|
||||
self.load_directory()
|
||||
return True
|
||||
return False
|
||||
|
||||
def set_to_home(self):
|
||||
home = os.path.expanduser("~") + self.subpath
|
||||
|
|
|
@ -36,7 +36,7 @@ class TabMixin(WidgetMixin):
|
|||
notebook.set_current_page(index)
|
||||
|
||||
# FIXME: set_tab_reorderable doesn't seem to work...
|
||||
# notebook.set_tab_reorderable(tab, True)
|
||||
notebook.set_tab_reorderable(scroll, True)
|
||||
self.load_store(view, store, save_state)
|
||||
|
||||
def close_tab(self, widget, eve):
|
||||
|
@ -123,6 +123,10 @@ class TabMixin(WidgetMixin):
|
|||
except Exception as e:
|
||||
print(repr(e))
|
||||
|
||||
def update_path(self, widget, eve=None):
|
||||
print(widget)
|
||||
|
||||
|
||||
def do_action_from_bar_controls(self, widget, eve=None):
|
||||
action = widget.get_name()
|
||||
wid, tid = self.window_controller.get_active_data()
|
||||
|
@ -142,6 +146,11 @@ class TabMixin(WidgetMixin):
|
|||
dir = view.get_current_directory()
|
||||
self.create_tab(wid, dir)
|
||||
return
|
||||
if action == "path_entry":
|
||||
path = widget.get_text()
|
||||
traversed = view.set_path(path)
|
||||
if not traversed:
|
||||
return
|
||||
|
||||
self.load_store(view, store, True)
|
||||
self.set_path_text(wid, tid)
|
||||
|
|
Loading…
Reference in New Issue