Skip to content

Commit

Permalink
Dosya/dizin aktarmada yaşanan sorun giderildi.
Browse files Browse the repository at this point in the history
  • Loading branch information
zekiahmetbayar committed Aug 30, 2020
1 parent 92ebaf3 commit 7870236
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "/bin/python3"
}
Binary file added __pycache__/file_transfer.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/ssh_file_transfer.cpython-38.pyc
Binary file not shown.
28 changes: 22 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def main(self):
scrolled_window.add_with_viewport(self.listbox)
self.add(scrolled_window)

new_window_button = Gtk.Button("Add New Host")
new_window_button = Gtk.Button("Yeni Bağlantı")
new_window_button.connect('clicked',self.add_newhost_window)
self.toolbar()
self.table.attach(self.box,0,10,0,1)
Expand Down Expand Up @@ -459,7 +459,7 @@ def on_click_delete(self,action): # # Seçilen bağlantıyı silme fonksiyonu

def add_newhost_window(self,widget): ## Yeni açılan pencere
self.input_window = Gtk.Window()
self.input_window.set_title("Add New Host")
self.input_window.set_title("Yeni Bağlantı Ekle")
self.input_window.set_border_width(10)
self.table2 = Gtk.Table(n_rows=7, n_columns=0, homogeneous=True)
self.input_window.add(self.table2)
Expand All @@ -468,7 +468,7 @@ def add_newhost_window(self,widget): ## Yeni açılan pencere
self.host_name = Gtk.Entry()
self.user = Gtk.Entry()
self.port = Gtk.Entry()
self.submit_button = Gtk.Button("Send")
self.submit_button = Gtk.Button("Gönder")

self.host.set_placeholder_text("Host")
self.host_name.set_placeholder_text("HostName")
Expand Down Expand Up @@ -1019,12 +1019,21 @@ def on_drag_data_received(self, widget, drag_context, x, y, data, info, time):
localpath_list = localpath.split('/')
print("Received text: %s" % localpath)
print("Received text: %s" % remotepath)
self.put_dir(localpath,remotepath)


if os.path.isdir(localpath):
self.put_dir(localpath,remotepath)
elif os.path.isfile(localpath):
remotepathfile=remotepath+"/"+localpath_list[-1]
self.ftp.put(localpath, remotepathfile)


self.deneme_tree()

def put_dir(self, source, target):
localpath_list = []
localpath_list = source.split('/')

self.ftp.mkdir(target+"/"+localpath_list[-1])
self.ftp.chdir(target+"/"+localpath_list[-1])
target=target+"/"+localpath_list[-1]
Expand Down Expand Up @@ -1060,12 +1069,19 @@ def on_drag_data_received_2(self, widget, drag_context, x, y, data, info, time):
print("Received text: %s" % localpath)
print("Received text: %s" % remotepath)
remotepath=remotepath+"/"+localpath_list[-1]
self.download_dir(localpath,remotepath)

fileattr = self.ftp.lstat(localpath)
if S_ISDIR(fileattr.st_mode):
self.download_dir(localpath,remotepath)
if S_ISREG(fileattr.st_mode):
self.ftp.get(localpath,remotepath)

self.deneme_tree()

def download_dir(self,remote_dir, local_dir):

os.path.exists(local_dir) or os.makedirs(local_dir)
dir_items = self.ftp.listdir_attr(remote_dir)
dir_items = self.ftp.listdir_attr(remote_dir) ##

for item in dir_items:

Expand Down

0 comments on commit 7870236

Please sign in to comment.