Setting template for copy and cut.
This commit is contained in:
parent
15aa17a046
commit
b175f02dcc
18
src/versions/pyfm-0.0.1/PyFM/new/pyfm/pyfm
Executable file
18
src/versions/pyfm-0.0.1/PyFM/new/pyfm/pyfm
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# . CONFIG.sh
|
||||||
|
|
||||||
|
# set -o xtrace ## To debug scripts
|
||||||
|
# set -o errexit ## To exit on error
|
||||||
|
# set -o errunset ## To exit if a variable is referenced but not set
|
||||||
|
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
cd "${SCRIPTPATH}"
|
||||||
|
echo "Working Dir: " $(pwd)
|
||||||
|
|
||||||
|
source "/home/abaddon/Portable_Apps/py-venvs/flask-apps-venv/venv/bin/activate"
|
||||||
|
python .
|
||||||
|
}
|
||||||
|
main "$@";
|
@ -429,7 +429,11 @@
|
|||||||
<property name="scrollable">True</property>
|
<property name="scrollable">True</property>
|
||||||
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
<signal name="switch-page" handler="on_tab_switch_update" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkIconView">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="margin">6</property>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="tab">
|
<child type="tab">
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
|
@ -36,6 +36,9 @@ class Signals(PaneMixin, WindowMixin):
|
|||||||
self.window3 = self.builder.get_object("window3")
|
self.window3 = self.builder.get_object("window3")
|
||||||
self.window4 = self.builder.get_object("window4")
|
self.window4 = self.builder.get_object("window4")
|
||||||
self.notebooks = [self.window1, self.window2, self.window3, self.window4]
|
self.notebooks = [self.window1, self.window2, self.window3, self.window4]
|
||||||
|
self.selected_files = []
|
||||||
|
self.to_copy_files = []
|
||||||
|
self.to_cut_files = []
|
||||||
|
|
||||||
self.single_click_open = False
|
self.single_click_open = False
|
||||||
self.is_pane1_hidden = False
|
self.is_pane1_hidden = False
|
||||||
@ -122,9 +125,13 @@ class Signals(PaneMixin, WindowMixin):
|
|||||||
if self.ctrlDown and keyname == "h":
|
if self.ctrlDown and keyname == "h":
|
||||||
self.show_hide_hidden_files()
|
self.show_hide_hidden_files()
|
||||||
if self.ctrlDown and keyname == "c":
|
if self.ctrlDown and keyname == "c":
|
||||||
self.copy_file()
|
self.to_cut_files.clear()
|
||||||
|
self.copy_files()
|
||||||
|
if self.ctrlDown and keyname == "x":
|
||||||
|
self.to_copy_files.clear()
|
||||||
|
self.cut_files()
|
||||||
if self.ctrlDown and keyname == "v":
|
if self.ctrlDown and keyname == "v":
|
||||||
print("[paste] stub...")
|
self.paste_files()
|
||||||
|
|
||||||
|
|
||||||
def tear_down(self, widget=None, eve=None):
|
def tear_down(self, widget=None, eve=None):
|
||||||
|
@ -44,6 +44,7 @@ class TabMixin(WidgetMixin):
|
|||||||
self.set_window_title()
|
self.set_window_title()
|
||||||
|
|
||||||
def on_tab_switch_update(self, notebook, content=None, index=None):
|
def on_tab_switch_update(self, notebook, content=None, index=None):
|
||||||
|
self.selected_files.clear()
|
||||||
wid, tid = content.get_children()[0].get_name().split("|")
|
wid, tid = content.get_children()[0].get_name().split("|")
|
||||||
self.window_controller.set_active_data(wid, tid)
|
self.window_controller.set_active_data(wid, tid)
|
||||||
self.set_path_text(wid, tid)
|
self.set_path_text(wid, tid)
|
||||||
@ -111,17 +112,6 @@ class TabMixin(WidgetMixin):
|
|||||||
self.builder.get_object("refresh_view").released()
|
self.builder.get_object("refresh_view").released()
|
||||||
|
|
||||||
|
|
||||||
def get_uris(self, store, treePaths=None):
|
|
||||||
uris = []
|
|
||||||
|
|
||||||
for path in treePaths:
|
|
||||||
itr = store.get_iter(path)
|
|
||||||
file = store.get(itr, 1)[0]
|
|
||||||
fpath = f"file://{dir}/{file}"
|
|
||||||
uris.append(fpath)
|
|
||||||
|
|
||||||
return uris
|
|
||||||
|
|
||||||
def create_file(self):
|
def create_file(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -142,28 +132,22 @@ class TabMixin(WidgetMixin):
|
|||||||
def menu_bar_copy(self, widget, eve):
|
def menu_bar_copy(self, widget, eve):
|
||||||
self.copy_file()
|
self.copy_file()
|
||||||
|
|
||||||
def copy_file(self):
|
def copy_files(self):
|
||||||
wid, tid = self.window_controller.get_active_data()
|
wid, tid = self.window_controller.get_active_data()
|
||||||
print(wid)
|
iconview = self.builder.get_object(f"{wid}|{tid}|iconview")
|
||||||
print(tid)
|
|
||||||
notebook = self.builder.get_object(f"window_{wid}")
|
|
||||||
iconview = self.get_tab_iconview_from_notebook(notebook)
|
|
||||||
print(iconview)
|
|
||||||
store = iconview.get_model()
|
store = iconview.get_model()
|
||||||
treePaths = iconview.get_selected_items()
|
uris = self.format_to_uris(store, wid, tid, self.selected_files)
|
||||||
|
self.to_copy_files = uris
|
||||||
|
|
||||||
print(len(treePaths))
|
def cut_files(self):
|
||||||
for path in treePaths:
|
wid, tid = self.window_controller.get_active_data()
|
||||||
itr = store.get_iter(path)
|
iconview = self.builder.get_object(f"{wid}|{tid}|iconview")
|
||||||
file = store.get(itr, 1)[0]
|
store = iconview.get_model()
|
||||||
print(file)
|
uris = self.format_to_uris(store, wid, tid, self.selected_files)
|
||||||
|
self.to_cut_files = uris
|
||||||
|
|
||||||
# uris = self.get_uris(store, treePaths)
|
def paste_files(self):
|
||||||
# print(uris)
|
if len(self.to_copy_files):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
def cut_file(self):
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
def paste_file(self):
|
|
||||||
pass
|
|
||||||
|
@ -126,6 +126,7 @@ class WidgetMixin:
|
|||||||
|
|
||||||
grid.connect("button_release_event", self.grid_icon_single_left_click)
|
grid.connect("button_release_event", self.grid_icon_single_left_click)
|
||||||
grid.connect("item-activated", self.grid_icon_double_left_click)
|
grid.connect("item-activated", self.grid_icon_double_left_click)
|
||||||
|
grid.connect("selection-changed", self.grid_set_selected_items)
|
||||||
grid.connect("drag-data-get", self.grid_on_drag_set)
|
grid.connect("drag-data-get", self.grid_on_drag_set)
|
||||||
grid.connect("drag-data-received", self.grid_on_drag_data_received)
|
grid.connect("drag-data-received", self.grid_on_drag_data_received)
|
||||||
grid.connect("drag-motion", self.grid_on_drag_motion)
|
grid.connect("drag-motion", self.grid_on_drag_motion)
|
||||||
@ -140,6 +141,7 @@ class WidgetMixin:
|
|||||||
grid.show_all()
|
grid.show_all()
|
||||||
scroll.add(grid)
|
scroll.add(grid)
|
||||||
grid.set_name(f"{wid}|{view.id}")
|
grid.set_name(f"{wid}|{view.id}")
|
||||||
|
self.builder.expose_object(f"{wid}|{view.id}|iconview", grid)
|
||||||
self.builder.expose_object(f"{wid}|{view.id}", scroll)
|
self.builder.expose_object(f"{wid}|{view.id}", scroll)
|
||||||
return scroll, store
|
return scroll, store
|
||||||
|
|
||||||
|
@ -20,6 +20,19 @@ class WindowMixin(TabMixin):
|
|||||||
def get_fm_window(self, wid):
|
def get_fm_window(self, wid):
|
||||||
return self.window_controller.get_window_by_nickname(f"window_{wid}")
|
return self.window_controller.get_window_by_nickname(f"window_{wid}")
|
||||||
|
|
||||||
|
def format_to_uris(self, store, wid, tid, treePaths):
|
||||||
|
view = self.get_fm_window(wid).get_view_by_id(tid)
|
||||||
|
dir = view.get_current_directory()
|
||||||
|
uris = []
|
||||||
|
|
||||||
|
for path in treePaths:
|
||||||
|
itr = store.get_iter(path)
|
||||||
|
file = store.get(itr, 1)[0]
|
||||||
|
fpath = f"file://{dir}/{file}"
|
||||||
|
uris.append(fpath)
|
||||||
|
|
||||||
|
return uris
|
||||||
|
|
||||||
def set_window_title(self):
|
def set_window_title(self):
|
||||||
wid, tid = self.window_controller.get_active_data()
|
wid, tid = self.window_controller.get_active_data()
|
||||||
view = self.get_fm_window(wid).get_view_by_id(tid)
|
view = self.get_fm_window(wid).get_view_by_id(tid)
|
||||||
@ -31,6 +44,9 @@ class WindowMixin(TabMixin):
|
|||||||
view = self.get_fm_window(wid).get_view_by_id(tid)
|
view = self.get_fm_window(wid).get_view_by_id(tid)
|
||||||
path_entry.set_text(view.get_current_directory())
|
path_entry.set_text(view.get_current_directory())
|
||||||
|
|
||||||
|
def grid_set_selected_items(self, iconview):
|
||||||
|
self.selected_files = iconview.get_selected_items()
|
||||||
|
|
||||||
def grid_icon_single_left_click(self, iconview, eve):
|
def grid_icon_single_left_click(self, iconview, eve):
|
||||||
try:
|
try:
|
||||||
wid, tid = iconview.get_name().split("|")
|
wid, tid = iconview.get_name().split("|")
|
||||||
@ -105,18 +121,10 @@ class WindowMixin(TabMixin):
|
|||||||
|
|
||||||
def grid_on_drag_set(self, iconview, drag_context, data, info, time):
|
def grid_on_drag_set(self, iconview, drag_context, data, info, time):
|
||||||
action = iconview.get_name()
|
action = iconview.get_name()
|
||||||
|
wid, tid = action.split("|")
|
||||||
store = iconview.get_model()
|
store = iconview.get_model()
|
||||||
treePaths = iconview.get_selected_items()
|
treePaths = iconview.get_selected_items()
|
||||||
wid, tid = action.split("|")
|
uris = self.format_to_uris(store, wid, tid, treePaths)
|
||||||
view = self.get_fm_window(wid).get_view_by_id(tid)
|
|
||||||
dir = view.get_current_directory()
|
|
||||||
uris = []
|
|
||||||
|
|
||||||
for path in treePaths:
|
|
||||||
itr = store.get_iter(path)
|
|
||||||
file = store.get(itr, 1)[0]
|
|
||||||
fpath = f"file://{dir}/{file}"
|
|
||||||
uris.append(fpath)
|
|
||||||
|
|
||||||
data.set_uris(uris)
|
data.set_uris(uris)
|
||||||
event_system.push_gui_event(["refresh_tab", None, action])
|
event_system.push_gui_event(["refresh_tab", None, action])
|
||||||
|
Loading…
Reference in New Issue
Block a user