Skip to content

Commit

Permalink
trying to fix tests
Browse files Browse the repository at this point in the history
more gui bugs
  • Loading branch information
SteveDoyle2 committed Mar 31, 2019
1 parent b920b3e commit 53bece0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
5 changes: 3 additions & 2 deletions pyNastran/gui/gui_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ def update_menu_bar(self):
#"""loads a deflection file"""
#self._load_deflection_force(out_filename, is_deflection=True, is_force=False)

def setup_gui(self):
def setup_gui(self, is_gui=True):
"""
Setup the gui
Expand Down Expand Up @@ -1393,7 +1393,8 @@ def setup_gui(self):
self.create_corner_axis()
#-------------
# loading
self.show()
if is_gui:
self.show()

def setup_post(self, inputs):
"""interface for user defined post-scripts"""
Expand Down
6 changes: 5 additions & 1 deletion pyNastran/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@ def __init__(self, inputs, **kwds):
self.set_script_path(SCRIPT_PATH)
self.set_icon_path(ICON_PATH)

is_gui = True
if 'is_gui' in inputs:
is_gui = inputs['is_gui']
assert isinstance(is_gui, bool), is_gui
self.start_logging()
self._load_plugins()
self.setup_gui()
self.setup_gui(is_gui)
self.setup_post(inputs)
self._check_for_latest_version()

Expand Down
1 change: 1 addition & 0 deletions pyNastran/gui/menus/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_real_gui(self):
inputs = {
'debug' : True,
'is_groups' : True,
'is_gui' : False,
#'log' : 'debug',
'log' : None,
'geomscript' : None,
Expand Down
20 changes: 15 additions & 5 deletions pyNastran/gui/utils/load_results.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
"""
defines:
- version_latest, version_current, is_newer = check_for_newer_version(version_current=None)
- res_obj, title = create_res_obj(
islot, headers, header, A, fmt_dict, result_type,
is_deflection=False, is_force=False,
dim_max=None, xyz_cid0=None, colormap='jet')
- B, fmt_dict_without_index, names_without_index = load_deflection_csv(
out_filename, encoding='latin1')
- A, fmt_dict, names = load_csv(out_filename, encoding='latin1')
- grid_ids, xyz, bars, tris, quads = load_user_geom(fname, log=None, encoding='latin1')
"""
from __future__ import print_function
import os
#import re
Expand Down Expand Up @@ -37,10 +49,9 @@ def check_for_newer_version(version_current=None):
target_url = 'https://raw.githubusercontent.com/SteveDoyle2/pyNastran/master/README.md'
try:
# it's a file like object and works just like a file
# import urllib2
# data = urllib.request.urlopen(target_url)
data = urllib.request.urlopen(target_url)
except: # urllib2.URLError
except (urllib.error.HTTPError, urllib.error.URLError):
#except: # urllib2.URLError
#print(help(urllib))
#raise
return None, None, is_newer
Expand Down Expand Up @@ -434,7 +445,7 @@ def load_user_geom(fname, log=None, encoding='latin1'):
assert len(sline) == 6, sline
quads.append(sline[1:])
else:
self.log.warning(sline)
log.warning(sline)

grid_ids = np.array(grid_ids, dtype='int32')
xyz = np.array(xyz, dtype='float32')
Expand Down Expand Up @@ -462,4 +473,3 @@ def load_user_geom(fname, log=None, encoding='latin1'):

if __name__ == '__main__': # pragma: no cover
check_for_newer_version()

4 changes: 1 addition & 3 deletions pyNastran/gui/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ def check_for_newer_version():
target_url = 'https://raw.githubusercontent.com/SteveDoyle2/pyNastran/master/README.md'
try:
# it's a file like object and works just like a file
# import urllib2
# data = urllib.request.urlopen(target_url)
data = urllib.request.urlopen(target_url)
except (urllib2.HTTPError, urllib2.URLError):
except (urllib.error.HTTPError, urllib.error.URLError):
#print(help(urllib))
#raise
return None, None, False
Expand Down

0 comments on commit 53bece0

Please sign in to comment.