SpecLog 0.0.7__tar.gz → 0.0.8__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.
Files changed (38) hide show
  1. {speclog-0.0.7 → speclog-0.0.8}/PKG-INFO +5 -7
  2. {speclog-0.0.7 → speclog-0.0.8}/README.md +4 -6
  3. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/SpecLogger.py +9 -25
  4. speclog-0.0.8/SpecLog/version.py +1 -0
  5. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/PKG-INFO +5 -7
  6. {speclog-0.0.7 → speclog-0.0.8}/tests/test_core.py +18 -2
  7. speclog-0.0.7/SpecLog/version.py +0 -1
  8. {speclog-0.0.7 → speclog-0.0.8}/LICENSE +0 -0
  9. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/SpecLog.py +0 -0
  10. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/SpecMonitor.py +0 -0
  11. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/__init__.py +0 -0
  12. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/config/__init__.py +0 -0
  13. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/config/config.cfg +0 -0
  14. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/config/config.py +0 -0
  15. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/config/monitor_config.cfg +0 -0
  16. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/config_editor.py +0 -0
  17. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/debugLog.py +0 -0
  18. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/device.py +0 -0
  19. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/history.py +0 -0
  20. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/loggerConfig.py +0 -0
  21. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/logger_status.py +0 -0
  22. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/monitor.py +0 -0
  23. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/monitor_style.py +0 -0
  24. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/run_logger.pyw +0 -0
  25. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/run_monitor.pyw +0 -0
  26. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/startup_task.py +0 -0
  27. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/ui/__init__.py +0 -0
  28. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/ui/config_editor.py +0 -0
  29. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/ui/historical_data.py +0 -0
  30. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/ui/plotting.py +0 -0
  31. {speclog-0.0.7 → speclog-0.0.8}/SpecLog/ui/plotting.ui +0 -0
  32. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/SOURCES.txt +0 -0
  33. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/dependency_links.txt +0 -0
  34. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/entry_points.txt +0 -0
  35. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/requires.txt +0 -0
  36. {speclog-0.0.7 → speclog-0.0.8}/SpecLog.egg-info/top_level.txt +0 -0
  37. {speclog-0.0.7 → speclog-0.0.8}/pyproject.toml +0 -0
  38. {speclog-0.0.7 → speclog-0.0.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SpecLog
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: A Python Package for logging data from instrumentations
5
5
  Author-email: Yen-Chun Huang <yen-chun.huang@bruker.com>
6
6
  License-Expression: MIT
@@ -101,16 +101,14 @@ SpecLogger start
101
101
  SpecLogger stop
102
102
  ```
103
103
 
104
+ These commands control the installed **SpecLogger** scheduled task; they do not
105
+ start a separate logger process. Enable the startup task first if it is not yet
106
+ installed.
107
+
104
108
  You can also use **Start** and **Stop** at the bottom of the configuration
105
109
  editor. Current status is shown as **Running**, **Stopped**, or **Status
106
110
  unavailable**. Operation results and errors appear in the **Messages** area.
107
111
 
108
- For troubleshooting, start the logger with a visible debug console:
109
-
110
- ```text
111
- SpecLogger -debug True
112
- ```
113
-
114
112
  ## Start logging automatically without login
115
113
 
116
114
  Open a terminal as Administrator and enable system startup:
@@ -82,16 +82,14 @@ SpecLogger start
82
82
  SpecLogger stop
83
83
  ```
84
84
 
85
+ These commands control the installed **SpecLogger** scheduled task; they do not
86
+ start a separate logger process. Enable the startup task first if it is not yet
87
+ installed.
88
+
85
89
  You can also use **Start** and **Stop** at the bottom of the configuration
86
90
  editor. Current status is shown as **Running**, **Stopped**, or **Status
87
91
  unavailable**. Operation results and errors appear in the **Messages** area.
88
92
 
89
- For troubleshooting, start the logger with a visible debug console:
90
-
91
- ```text
92
- SpecLogger -debug True
93
- ```
94
-
95
93
  ## Start logging automatically without login
96
94
 
97
95
  Open a terminal as Administrator and enable system startup:
@@ -8,7 +8,6 @@ import argparse
8
8
  import shutil
9
9
  import subprocess
10
10
  from .SpecLog import *
11
- from .logger_status import is_logger_running
12
11
  from .startup_task import (
13
12
  TASK_SCHEDULER,
14
13
  control_arguments,
@@ -71,12 +70,17 @@ def configure_startup(enabled, executable=None, runner=None):
71
70
 
72
71
 
73
72
  def control_scheduled_logger(action, runner=None):
74
- """Start/stop the startup task, or return None when it is not installed."""
73
+ """Start or stop SpecLogger exclusively through Windows Task Scheduler."""
75
74
  query = _run_task_scheduler(
76
75
  query_arguments(), runner
77
76
  )
78
77
  if query.returncode:
79
- return None
78
+ details = (query.stderr or query.stdout).strip()
79
+ raise RuntimeError(
80
+ details
81
+ or "The SpecLogger scheduled task is not installed or is unavailable. "
82
+ "Enable startup first with 'SpecLogger -startup True'."
83
+ )
80
84
  result = _run_task_scheduler(
81
85
  control_arguments(action), runner
82
86
  )
@@ -171,28 +175,8 @@ def main_func(argv=None):
171
175
  except RuntimeError as error:
172
176
  print(f"Could not control SpecLogger scheduled task: {error}", file=sys.stderr)
173
177
  return 1
174
- if task_message is not None:
175
- print(task_message)
176
- return 0
177
-
178
- if args.status == "start":
179
- if is_logger_running():
180
- print("SpecLogger has started already.")
181
- return
182
- if args.debug == "False":
183
- subprocess.Popen(
184
- "SpecLogger_running.exe", creationflags=subprocess.CREATE_NO_WINDOW
185
- )
186
- print("SpecLogger started")
187
- elif args.debug == "True":
188
- os.startfile("SpecLogger_running.exe")
189
- print("SpecLogger debug mode started")
190
-
191
- elif args.status == "stop":
192
- os.system("taskkill /im SpecLogger_running.exe /F /t")
193
- print("SpecLogger stopped")
194
- else: # ignore
195
- return
178
+ print(task_message)
179
+ return 0
196
180
 
197
181
 
198
182
  if __name__ == "__main__":
@@ -0,0 +1 @@
1
+ __version__ = "0.0.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SpecLog
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: A Python Package for logging data from instrumentations
5
5
  Author-email: Yen-Chun Huang <yen-chun.huang@bruker.com>
6
6
  License-Expression: MIT
@@ -101,16 +101,14 @@ SpecLogger start
101
101
  SpecLogger stop
102
102
  ```
103
103
 
104
+ These commands control the installed **SpecLogger** scheduled task; they do not
105
+ start a separate logger process. Enable the startup task first if it is not yet
106
+ installed.
107
+
104
108
  You can also use **Start** and **Stop** at the bottom of the configuration
105
109
  editor. Current status is shown as **Running**, **Stopped**, or **Status
106
110
  unavailable**. Operation results and errors appear in the **Messages** area.
107
111
 
108
- For troubleshooting, start the logger with a visible debug console:
109
-
110
- ```text
111
- SpecLogger -debug True
112
- ```
113
-
114
112
  ## Start logging automatically without login
115
113
 
116
114
  Open a terminal as Administrator and enable system startup:
@@ -17,6 +17,7 @@ from SpecLog.SpecLogger import (
17
17
  _build_parser as build_logger_parser,
18
18
  configure_startup,
19
19
  control_scheduled_logger,
20
+ main_func as logger_main,
20
21
  )
21
22
  from SpecLog.loggerConfig import loggerConfig
22
23
 
@@ -114,13 +115,28 @@ class SpecLoggerCliTests(unittest.TestCase):
114
115
  self.assertIn("/End", runner.call_args_list[1].args[0])
115
116
  self.assertIn("stopped", message)
116
117
 
117
- def test_process_control_falls_back_when_task_is_missing(self):
118
+ def test_process_control_fails_when_task_is_missing(self):
118
119
  missing = SimpleNamespace(returncode=1, stdout="", stderr="")
119
120
  runner = Mock(return_value=missing)
120
121
 
121
- self.assertIsNone(control_scheduled_logger("start", runner))
122
+ with self.assertRaisesRegex(RuntimeError, "scheduled task"):
123
+ control_scheduled_logger("start", runner)
122
124
  self.assertEqual(runner.call_count, 1)
123
125
 
126
+ def test_default_command_only_requests_scheduled_task(self):
127
+ with (
128
+ patch(
129
+ "SpecLog.SpecLogger.control_scheduled_logger",
130
+ return_value="SpecLogger scheduled task start requested.",
131
+ ) as control,
132
+ patch("SpecLog.SpecLogger.subprocess.Popen") as popen,
133
+ ):
134
+ result = logger_main([])
135
+
136
+ self.assertEqual(result, 0)
137
+ control.assert_called_once_with("start")
138
+ popen.assert_not_called()
139
+
124
140
 
125
141
  class ConfigEditorTests(unittest.TestCase):
126
142
  def test_required_settings_validation(self):
@@ -1 +0,0 @@
1
- __version__ = "0.0.7"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes