You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
4.2 KiB
102 lines
4.2 KiB
diff --git console/application/function.py console/application/function.py
|
|
index 77968b5..65517b0 100644
|
|
--- console/application/function.py
|
|
+++ console/application/function.py
|
|
@@ -13,6 +13,7 @@
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
+from itertools import cycle
|
|
|
|
import time, os, sys, re
|
|
from fcntl import ioctl
|
|
@@ -322,11 +323,19 @@ def get_messages(client, sid, pid):
|
|
def get_Frame(client, sid, pid):
|
|
""" get all messages, until type is not endFrame (or Error) """
|
|
end_frame = 1
|
|
+ spinner = cycle('/-\|')
|
|
while end_frame:
|
|
current_frame = client.service[0].get_frame(sid, pid, "console")
|
|
+ sys.stdout.write(spinner.next())
|
|
+ sys.stdout.flush()
|
|
while current_frame in [None, [], ""]:
|
|
- time.sleep(float(client.frame_period))
|
|
+ sys.stdout.write("\b%s"% spinner.next())
|
|
+ sys.stdout.flush()
|
|
+ time.sleep(float(client.frame_period)/10)
|
|
current_frame = client.service[0].get_frame(sid, pid, "console")
|
|
+ sys.stdout.write('\b')
|
|
+ sys.stdout.flush()
|
|
+
|
|
for item in current_frame[0]:
|
|
end_frame = get_message(client, item, sid, pid)
|
|
|
|
diff --git console/application/methods_func.py console/application/methods_func.py
|
|
index 52d0aba..0bc6f7a 100644
|
|
--- console/application/methods_func.py
|
|
+++ console/application/methods_func.py
|
|
@@ -15,14 +15,18 @@
|
|
# limitations under the License.
|
|
|
|
import argparse, sys
|
|
-from function import _create_obj, get_view_params, print_brief
|
|
+from calculate.core.server.api_types import ViewInfoAdapter
|
|
+from calculate.core.server.replace_class import Methods
|
|
+from function import _create_obj, get_view_params, print_brief, _print, \
|
|
+ colorPrint
|
|
from calculate.lib.cl_lang import setLocalTranslate
|
|
setLocalTranslate('cl_console3',sys.modules[__name__])
|
|
import urllib2
|
|
|
|
from calculate.core.server.methods_func import get_method_argparser, \
|
|
collect_object, RawAndDefaultsHelpFormatter, \
|
|
- check_result_msg, get_param_pwd, getErrorOnParam
|
|
+ check_result_msg, get_param_pwd, display_error
|
|
+
|
|
|
|
def parse():
|
|
parser = argparse.ArgumentParser(add_help=False,
|
|
@@ -158,18 +162,13 @@ def call_method(client, args, unknown_args, wait_thread):
|
|
sys.stdout.flush()
|
|
print_brief(view, steps.label)
|
|
if not no_questions:
|
|
- while True:
|
|
- try:
|
|
- ask = raw_input('\n' + _('Run the process? (yes/no): '))
|
|
- red = '\033[31m * \033[0m'
|
|
- except KeyboardInterrupt:
|
|
- ask = 'no'
|
|
- red = '\n'+'\033[31m * \033[0m'
|
|
- if ask.lower() in ['n', 'no']:
|
|
- print red + _("Manually interrupted")
|
|
- return None
|
|
- if ask.lower() in ['y', 'yes']:
|
|
- break
|
|
+ try:
|
|
+ ask = Methods().askConfirm(_("Run process?"))
|
|
+ except KeyboardInterrupt:
|
|
+ ask = "no"
|
|
+ if ask.lower() in ['n', 'no']:
|
|
+ colorPrint.printERROR(_('Manually interrupted'))
|
|
+ return None
|
|
|
|
param_object['CheckOnly'] = False
|
|
else:
|
|
@@ -180,14 +179,9 @@ def call_method(client, args, unknown_args, wait_thread):
|
|
return None
|
|
if method_result.ReturnedMessage[0].type and \
|
|
method_result.ReturnedMessage[0].type != "pid":
|
|
+ view = ViewInfoAdapter(view)
|
|
for error in method_result.ReturnedMessage:
|
|
- params_text = ''
|
|
- for Group in view.groups.GroupField:
|
|
- for field in Group.fields.Field:
|
|
- if field.name == error.field:
|
|
- params_text += getErrorOnParam(args,field)
|
|
- red = '\033[31m * \033[0m'
|
|
- _print ('\r' + red + params_text % error.message)
|
|
+ display_error(error, args, view.groups)
|
|
return None
|
|
wait_thread.stop()
|
|
return method_result
|