xrdPlanner 2.4.1__tar.gz → 2.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: xrdPlanner
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: A tool to project X-ray diffraction cones on a detector screen at different geometries (tilt, rotation, offset) and X-ray energies
5
5
  Author-email: Lennard Krause <lkrause@chem.au.dk>
6
6
  Project-URL: Homepage, https://github.com/LennardKrause/xrdPlanner
@@ -19,6 +19,7 @@ Requires-Dist: pyqtgraph>=0.13
19
19
  Requires-Dist: Dans_Diffraction>=2.2.3
20
20
  Requires-Dist: PyQt6>=6.5
21
21
  Requires-Dist: pyFAI>=2023.5
22
+ Dynamic: license-file
22
23
 
23
24
  # xrdPlanner
24
25
  ## Version 2.4.1 (released 05.03.2025)
@@ -1,6 +1,6 @@
1
- __version__ = '2.4.1'
1
+ __version__ = '2.4.2'
2
2
  __author__ = 'Lennard Krause'
3
3
  __authors__ = ['Lennard Krause', 'Frederik H. Gjørup', 'Mads R. V. Jørgensen']
4
4
  __email__ = 'lkrause@chem.au.dk'
5
- __date__ = '05.03.2025'
5
+ __date__ = '01.04.2025'
6
6
  __year__ = '2025'
@@ -34,7 +34,7 @@ class MainWindow(QtWidgets.QMainWindow):
34
34
  super().__init__(*args, **kwargs)
35
35
 
36
36
  # set path home
37
- self.path_home = os.path.dirname(__file__)
37
+ self.path_home = os.getenv('XRDPLANNER', os.path.dirname(__file__))
38
38
  #self.setMouseTracking(True)
39
39
 
40
40
  # enable antialiasing
@@ -2767,7 +2767,6 @@ class MainWindow(QtWidgets.QMainWindow):
2767
2767
  self.pxrd_line = pg.InfiniteLine(pos=0, angle=0, pen=pg.mkPen(None))
2768
2768
  self.pxrd_plot.addItem(self.pxrd_line)
2769
2769
 
2770
-
2771
2770
  self.pxrd_ghost_curves = [] # list to store ghost lines
2772
2771
  self.pxrd_ghost_bank = [('blinky', '#fb0009'), ('pinky', '#fc60ff'), ('inky', '#22ffff'),
2773
2772
  ('clyde', '#f27a10'), ('sue', '#9208ff'), ('dinky', '#e1e1e1'),
@@ -3032,18 +3031,22 @@ class MainWindow(QtWidgets.QMainWindow):
3032
3031
  pxrd_ghost_bank (list): List to store removed ghost curves with their
3033
3032
  name and pen color.
3034
3033
  """
3034
+ # find all invisible ghosts
3035
3035
  remove_later = []
3036
3036
  for ghost in self.pxrd_ghost_curves:
3037
3037
  if not ghost.isVisible():
3038
3038
  remove_later.append(ghost)
3039
+ # remove them, append to ghost bank
3039
3040
  for ghost in remove_later:
3040
3041
  self.pxrd_plot.getPlotItem().removeItem(ghost)
3041
3042
  self.pxrd_ghost_curves.remove(ghost)
3042
3043
  self.pxrd_ghost_bank.insert(0, (ghost.name(), ghost.opts['pen'].color().name()))
3044
+ # if nothing was flagged, remove the last, append to ghost bank
3043
3045
  if len(remove_later) == 0 and len(self.pxrd_ghost_curves) > 0:
3044
3046
  ghost = self.pxrd_ghost_curves[-1]
3045
3047
  self.pxrd_plot.getPlotItem().removeItem(ghost)
3046
3048
  self.pxrd_ghost_curves.remove(ghost)
3049
+ self.pxrd_ghost_bank.insert(0, (ghost.name(), ghost.opts['pen'].color().name()))
3047
3050
 
3048
3051
  #######
3049
3052
  # CIF #
@@ -4240,7 +4243,7 @@ class MainWindow(QtWidgets.QMainWindow):
4240
4243
  self.path_settings_current = os.path.join(self.path_settings, name)
4241
4244
  self.settings_reload()
4242
4245
 
4243
- def settings_import_win(self):
4246
+ def settings_import_win(self, fname=None):
4244
4247
  """
4245
4248
  Opens a file dialog to import a settings file in JSON format. If a file is selected,
4246
4249
  it copies the file to the settings folder, adds it to the custom settings menu,
@@ -4255,7 +4258,9 @@ class MainWindow(QtWidgets.QMainWindow):
4255
4258
  Returns:
4256
4259
  None
4257
4260
  """
4258
- fname, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Import settings file', '', "Settings files (*.json)")
4261
+ if fname is None:
4262
+ fname, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Import settings file', '', "Settings files (*.json)")
4263
+
4259
4264
  if fname:
4260
4265
  # copy to settings folder
4261
4266
  shutil.copy(fname, self.path_settings)
@@ -4334,8 +4339,12 @@ class MainWindow(QtWidgets.QMainWindow):
4334
4339
  None
4335
4340
  """
4336
4341
  fpath = event.mimeData().urls()[0].toLocalFile()
4342
+
4337
4343
  if os.path.splitext(fpath)[1] == '.cif':
4338
4344
  self.calc_ref_from_cif(fpath, open_pxrd=True)
4345
+
4346
+ if os.path.splitext(fpath)[1] == '.json':
4347
+ self.settings_import_win(fname=fpath)
4339
4348
 
4340
4349
  def keyReleaseEvent(self, event):
4341
4350
  """
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: xrdPlanner
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: A tool to project X-ray diffraction cones on a detector screen at different geometries (tilt, rotation, offset) and X-ray energies
5
5
  Author-email: Lennard Krause <lkrause@chem.au.dk>
6
6
  Project-URL: Homepage, https://github.com/LennardKrause/xrdPlanner
@@ -19,6 +19,7 @@ Requires-Dist: pyqtgraph>=0.13
19
19
  Requires-Dist: Dans_Diffraction>=2.2.3
20
20
  Requires-Dist: PyQt6>=6.5
21
21
  Requires-Dist: pyFAI>=2023.5
22
+ Dynamic: license-file
22
23
 
23
24
  # xrdPlanner
24
25
  ## Version 2.4.1 (released 05.03.2025)
File without changes
File without changes
File without changes
File without changes