Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://localhost:14147/Users/pett/src/chimer…
Browse files Browse the repository at this point in the history
…ax into develop
  • Loading branch information
e-pettersen committed Feb 4, 2025
2 parents b68a797 + 4f54f20 commit a45d7a5
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ src/bundles/chem_group/src/__init__.py
src/bundles/chem_group/bundle_info.xml
src/bundles/looking_glass/holoplaycore-*.tar.gz
src/bundles/md_crds/gromacs/xdrfile-1.1b/
src/bundles/md_crds/gromacs/xdrfile-1.1.4/
src/bundles/meeting/src/server.pem
src/bundles/mmcif/mmcif_cpp/include/
src/bundles/mmcif/src/mmcif.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/basic_actions/bundle_info.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<BundleInfo name="ChimeraX-BasicActions" version="1.1.2"
<BundleInfo name="ChimeraX-BasicActions" version="1.1.3"
package="chimerax.basic_actions" customInit="true"
minSessionVersion="1" maxSessionVersion="1">

Expand Down
5 changes: 4 additions & 1 deletion src/bundles/basic_actions/src/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def name_frozen(session, name, objects):
if _is_reserved(name):
raise UserError("\"%s\" is reserved and cannot be redefined" % name)
if objects.empty():
raise UserError("nothing is selected by specifier")
if session.in_script:
session.logger.warning("Nothing is selected by specifier")
else:
raise UserError("Nothing is selected by specifier")
from chimerax.core.commands import register_selector
register_selector(name, objects, session.logger, user=True)
session.basic_actions.define(name, objects)
Expand Down
4 changes: 4 additions & 0 deletions src/bundles/core/src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ def init(argv, event_loop=True):

# initialize qt
if opts.gui:
if os.environ.get("WAYLAND_DISPLAY", ""):
# ChimeraX needs to use XWayland for now
os.environ["QT_QPA_PLATFORM"] = "xcb"
os.environ["PYOPENGL_PLATFORM"] = "x11"
from chimerax.ui import initialize_qt

initialize_qt()
Expand Down
14 changes: 13 additions & 1 deletion src/bundles/dicom/src/dicom_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def __init__(
rsi = int(rsi)
self.rescale_intercept = rsi
self.rescale_slope = int(self.dicom_series.rescale_slope)
if not self.contour_series:
if self.image_series and not self.contour_series:
bits = self.sample_file.get("BitsAllocated")
rep = self.sample_file.get("PixelRepresentation")
self.value_type = self.numpy_value_type(
Expand Down Expand Up @@ -663,6 +663,18 @@ def to_models(self, open_models, derived, sgrids):
"be available." % (self.number, self.patient_id)
)

@property
def number(self):
if self.sample_file.get("SeriesNumber", None) is None:
self.session.logger.warning("SeriesNumber not specified; setting to 0")
return 0
else:
return int(self.sample_file.get("SeriesNumber", 0))

@property
def patient_id(self):
return self.sample_file.get("PatientID", "")

@property
def columns(self):
return self.sample_file.get("Columns")
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/graphics/src/vertexShader.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uniform mat4 view_matrix; // Map scene coordinates to camera coordinates
#endif

#if defined(USE_VOLUME_RAYCASTING)
uniform vec3 step_size;
uniform float step_size;
uniform vec3 camera_pos;
uniform float camera_fov;
uniform vec2 window_size;
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/open_command/bundle_info.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<BundleInfo name="ChimeraX-OpenCommand" version="1.14" package="chimerax.open_command"
<BundleInfo name="ChimeraX-OpenCommand" version="1.14.1" package="chimerax.open_command"
minSessionVersion="1" maxSessionVersion="1">

<!-- Additional information about bundle source -->
Expand Down
17 changes: 11 additions & 6 deletions src/bundles/open_command/src/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ def set_use_native_open_file_dialog(use):
global _use_native_open_file_dialog
_use_native_open_file_dialog = use

def make_qt_name_filters(session, *, no_filter="All files (*)"):
def make_qt_name_filters(session, *, no_filter="All files (*)", format_names=None):
openable_formats = [fmt for fmt in session.open_command.open_data_formats if fmt.suffixes]
if format_names is not None:
openable_formats = [fmt for fmt in openable_formats if fmt.name in format_names]
openable_formats.sort(key=lambda fmt: fmt.synopsis.casefold())
file_filters = ["%s (%s)" % (fmt.synopsis, "*" + " *".join(fmt.suffixes))
for fmt in openable_formats]
if no_filter is not None:
if no_filter is not None and format_names is None:
file_filters = [no_filter] + file_filters
return file_filters, openable_formats, no_filter

Expand All @@ -293,13 +295,16 @@ def show_fetch_by_id_dialog(session, database_name=None, *, debug=False):
_fetch_by_id_dialog.show()
_fetch_by_id_dialog.raise_()

def show_open_file_dialog(session, initial_directory=None, format_name=None):
def show_open_file_dialog(session, initial_directory=None, format_names=None):
if initial_directory is None:
initial_directory = ''
file_filters, openable_formats, no_filter = make_qt_name_filters(session)
file_filters, openable_formats, no_filter = make_qt_name_filters(session, format_names=format_names)
fmt_name2filter = dict(zip([fmt.name for fmt in openable_formats], file_filters[1:]))
filter2fmt = dict(zip(file_filters[1:], openable_formats))
filter2fmt[no_filter] = None
if format_names is None:
filter2fmt = dict(zip(file_filters[1:], openable_formats))
filter2fmt[no_filter] = None
else:
filter2fmt = dict(zip(file_filters, openable_formats))
from Qt.QtWidgets import QFileDialog
qt_filter = ";;".join(file_filters)
if _use_native_open_file_dialog:
Expand Down

0 comments on commit a45d7a5

Please sign in to comment.