-
Notifications
You must be signed in to change notification settings - Fork 4
/
dataset_commands.py
53 lines (39 loc) · 1.63 KB
/
dataset_commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from common import *
import common
class Open_datasetCommand(sublime_plugin.WindowCommand):
def run(self):
settings = Settings()
self.ftp_client = z_OS_FTP_Client(settings)
self.window.show_input_panel("Name of loaded dataset",
"*.*", self.on_input, None, None)
def on_input(self, user_input):
if user_input != '':
result = self.ftp_client.open_dataset(user_input)
self.display(result)
print("Dataset " + user_input + "opened")
else:
sublime.error_message("Empty dataset name")
def display(self,text):
view = self.window.new_file()
view.run_command("new_zos_file",{ "text" : text});
class Save_datasetCommand(sublime_plugin.TextCommand):
def run(self,edit):
settings = Settings()
self.window = sublime.active_window()
self.ftp_client = z_OS_FTP_Client(settings)
self.window.show_input_panel("Name of saved dataset",
"*.*", self.on_input, None, None)
def on_input(self, user_input):
active_file_name = self.view.file_name()
if active_file_name is None:
sublime.error_message("Save file before submitting")
return
file_path = os.path.join(common.__location__,active_file_name)
if user_input != '':
self.ftp_client.save_dataset(file_path,user_input)
print("Dataset " + user_input + "saved")
else:
sublime.error_message("Empty dataset name")
def display(self,text):
view = self.window.new_file()
view.run_command("new_zos_file",{ "text" : text});