-
Notifications
You must be signed in to change notification settings - Fork 4
/
submit_commands.py
112 lines (69 loc) · 2.92 KB
/
submit_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from common import *
import common
def display(text):
window = sublime.active_window()
view = window.new_file()
view.run_command("new_zos_file",{ "text" : text});
class Submit_job_and_waitCommand(sublime_plugin.TextCommand):
def run(self,edit):
settings = Settings()
ftp_client = z_OS_FTP_Client(settings)
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)
result = ftp_client.submit_job_and_wait(file_path)
display(result)
print("Job submitted")
class Submit_jobCommand(sublime_plugin.WindowCommand):
def run(self):
settings = Settings()
ftp_client = z_OS_FTP_Client(settings)
view = self.window.active_view()
active_file_name = 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)
result = ftp_client.submit_job(file_path)
print("Job submitted")
class Submit_job_with_host_and_waitCommand(sublime_plugin.TextCommand):
def run(self,edit):
window = sublime.active_window()
self.active_file_name = self.view.file_name()
if self.active_file_name is None:
sublime.error_message("Save file before submitting")
return
window.show_input_panel("Enter host name: ",
"*.*", self.on_input, None, None)
def on_input(self, user_input):
if user_input != '':
settings = Settings()
settings.host = user_input
file_path = os.path.join(common.__location__,self.active_file_name)
ftp_client = z_OS_FTP_Client(settings)
result = ftp_client.submit_job_and_wait(file_path)
display(result)
print("Job submitted")
else:
sublime.error_message("Empty host name")
class Submit_job_with_hostCommand(sublime_plugin.WindowCommand):
def run(self,edit):
view = self.window.active_view()
self.active_file_name = view.file_name()
if self.active_file_name is None:
sublime.error_message("Save file before submitting")
return
self.window.show_input_panel("Enter host name: ",
"*.*", self.on_input, None, None)
def on_input(self, user_input):
if user_input != '':
settings = Settings()
settings.host = user_input
file_path = os.path.join(common.__location__,self.active_file_name)
ftp_client = z_OS_FTP_Client(settings)
result = ftp_client.submit_job(file_path)
print("Job submitted")
else:
sublime.error_message("Empty host name")