PrEditor 0.9.0__py2.py3-none-any.whl → 0.10.0__py2.py3-none-any.whl

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.

Potentially problematic release.


This version of PrEditor might be problematic. Click here for more details.

preditor/__init__.py CHANGED
@@ -66,51 +66,74 @@ def init():
66
66
 
67
67
 
68
68
  def configure(name, parent_callback=None, excepthook=True, logging=True, streams=True):
69
- """Global configuration of PrEditor. Nothing is done if called more than once.
69
+ """Global configuration of PrEditor. Safe to re-call until the instance is created.
70
+
71
+ Configures the instance of PrEditor without creating the GUI. It should be run
72
+ as early as possible in the applications initialization to allow PrEditor to
73
+ show as much stdout/err text as possible even the text printed before the
74
+ application's GUI is created.
75
+
76
+ Once `preditor.instance(create=True)` is called this will return without
77
+ making any changes. Otherwise unless noted with "First call only." each time
78
+ this function is called it will update any previously set values. This allows
79
+ you to minimally configure PrEditor and as more of the application comes
80
+ online enable more advanced features.
70
81
 
71
82
  Args:
72
83
  name (str): The core_name to use for the global instance of PrEditor.
73
84
  Once this has been set, you can call `launch` without passing name
74
- to access the main instance.
85
+ to access the main instance. The core_name controls what preferences
86
+ are loaded and used by PrEditor including the workbox tabs.
75
87
  parent_callback (callable, optional): Callback that returns a QWidget
76
88
  to use as the parent of the LoggerWindow when its first created.
77
89
  This can be used by DCC's to set the parent to their main window.
78
- excepthook (bool, optional): Replaces `sys.excepthook` with a interactive
79
- exception handler that prompts the user to show PrEditor when an
80
- python exception is raised.
81
- logging (bool, optional): Restore the python logging configuration that
82
- was recorded the last time PrEditor prefs were saved.
83
- streams (bool, optional): Install the stream manager to capture any
84
- stdout/stderr text written. Later when calling launch, the
90
+ excepthook (bool, optional): First call only. Replaces `sys.excepthook`
91
+ with a interactive exception handler that prompts the user to show
92
+ PrEditor when an python exception is raised. It is recommended that
93
+ you only add the excepthook once the Qt UI is initialized.
94
+ logging (bool, optional): Restore the python logging configuration settings
95
+ that were recorded the last time PrEditor prefs were saved. If called
96
+ multiple times with different core_name's before the instance is
97
+ created, this will reset the logging configuration from the previous
98
+ core_name if logging prefs exist.
99
+ streams (bool, optional): First call only. Install the stream manager to
100
+ capture any stdout/stderr text written. Later when calling launch, the
85
101
  LoggerWindow will show all of the captured text. This lets you only
86
- create the LoggerWindow IF you need to, but when you do it will have
87
- all of the std stream text written after this call.
102
+ create the LoggerWindow IF you need to show it, but when you do it
103
+ will have all of the std stream text written after this call.
88
104
  """
89
- # Once this has been set, configure should not do anything
90
- if 'core_name' in _global_config:
105
+ # Once the UI instance has been created, configure should not do anything.
106
+ if instance(create=False):
91
107
  return
92
108
 
93
- # Store the core_name,.
109
+ # Store the core_name.
110
+ changed = _global_config.get('core_name') != name
94
111
  _global_config['core_name'] = name
95
112
  if parent_callback:
96
- set_parent_callback(parent_callback)
113
+ _global_config['parent_callback'] = parent_callback
97
114
 
98
- if streams:
115
+ if streams and not _global_config.get('streams_installed'):
99
116
  # Install the stream manager to capture output
100
117
  from preditor.stream import install_to_std
101
118
 
102
119
  install_to_std()
120
+ _global_config['streams_installed'] = True
103
121
 
104
- if logging:
122
+ if logging and changed:
123
+ # Only update the logging config if the core name has changed.
124
+ # Note: When called repeatedly, this won't remove old logger's added by
125
+ # the previous calls so you may see some loggers added that were never
126
+ # actually added by code other than the LoggingConfig.
105
127
  from .logging_config import LoggingConfig
106
128
 
107
129
  cfg = LoggingConfig(core_name=name)
108
130
  cfg.load()
109
131
 
110
- if excepthook:
132
+ if excepthook and not _global_config.get('excepthook_installed'):
111
133
  import preditor.debug
112
134
 
113
135
  preditor.debug.BlurExcepthook.install()
136
+ _global_config['excepthook_installed'] = True
114
137
 
115
138
 
116
139
  def get_core_name():
@@ -239,29 +262,6 @@ def parent_callback():
239
262
  return _global_config.get("parent_callback")
240
263
 
241
264
 
242
- def set_parent_callback(parent_callback, if_unset=True):
243
- """Update the parent_callback even if it was already set.
244
-
245
- This is useful for cases where `configure` is called before it's possible to
246
- provide the parent_callback.
247
-
248
- Note: Changing this does not re-parent an existing instance of LoggerWindows.
249
- If you change this after the LoggerWindow instance has been created you will
250
- need to manually re-parent it.
251
-
252
- Args:
253
- if_unset(bool): If True then only set this value if the parent_callback
254
- hasn't already been set.
255
-
256
- Returns:
257
- bool: Returns False if if_unset is True and it was already set.
258
- """
259
- if "parent_callback" in _global_config and not if_unset:
260
- return False
261
- _global_config["parent_callback"] = parent_callback
262
- return True
263
-
264
-
265
265
  def connect_preditor(
266
266
  parent, sequence='F2', text='Show PrEditor', obj_name='uiShowPreditorACT', name=None
267
267
  ):
preditor/version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
  # file generated by setuptools_scm
3
3
  # don't change, don't track in version control
4
- version = '0.9.0'
5
- version_tuple = (0, 9, 0)
4
+ version = '0.10.0'
5
+ version_tuple = (0, 10, 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PrEditor
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: A python REPL and Editor and console based on Qt.
5
5
  Home-page: https://github.com/blurstudio/PrEditor.git
6
6
  Author: Blur Studio
@@ -1,4 +1,4 @@
1
- preditor/__init__.py,sha256=LGEa5WqdedxVmOm_MeQ2kFDs3xodaWnOMGA8hLubg5E,11843
1
+ preditor/__init__.py,sha256=KYyR_3eeQBYqbl4pq6H0u7MnRquGJYfAXV5cSBOEufI,12732
2
2
  preditor/__main__.py,sha256=boRVSmxX6eF8EkzbePtCZbzdcaPseqVae4RPPLp3U1A,449
3
3
  preditor/about_module.py,sha256=KIvCxZrMLhm5TR6lYskM4Y9VctJ0QtSQD5Nu8Ip1CGY,5267
4
4
  preditor/cli.py,sha256=kyVr0V43KYSMLIEWXH54CA0ByFmPcpbFF-8cli6PVow,5300
@@ -11,7 +11,7 @@ preditor/plugins.py,sha256=ELajZq_ArzZPMvURpwZuLpsURF5vWrL22dLwx0rO3nA,4275
11
11
  preditor/prefs.py,sha256=BPtSsdv2yuiRpIaqEml9fxlVYKHNfqQ77hp5YIQRDBg,2172
12
12
  preditor/settings.py,sha256=DV9_DbJorEnhdIvW15E7h7PswlQUsy0UlA8bXUYN0og,2206
13
13
  preditor/streamhandler_helper.py,sha256=kiU6T9WqJ3JKTTKCa7IUU8brwK7zO5UUpEzLhEfKe44,1788
14
- preditor/version.py,sha256=OFbGax8ko2nIQ9RQvu77D8Lj3CgldGEFB97k9nRq6WA,142
14
+ preditor/version.py,sha256=rzq_luIbsfGvc5ytSRmGNkTTF5-zasKa-TxMl3t2XTg,144
15
15
  preditor/weakref.py,sha256=b--KomFAHcMWr3DEAIN2j3XxRhjDWKw0WABXyn1nxDg,12177
16
16
  preditor/cores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  preditor/cores/core.py,sha256=JNcW4Xx9OM-fuAhCLIunu3v501yM9rniia7P7SUyCfM,2127
@@ -150,9 +150,9 @@ preditor/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  preditor/utils/cute.py,sha256=LfF8gXMAkkQAdo4mm6J9aVkDLwWZbE6prQ0moDbtCys,1045
151
151
  preditor/utils/stylesheets.py,sha256=EVWZNq3WnaRiyUPoYMKQo_dLEwbRyKu26b03I1JDA-s,1622
152
152
  preditor/utils/text_search.py,sha256=21kuSDTpLIPUcriB81WP1kWfzuDBuP13ZtHUtypP5jE,14218
153
- preditor-0.9.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
154
- preditor-0.9.0.dist-info/METADATA,sha256=41tycEwN8Wb8SG1zchMUX81zQIRchAoLgO7Un2OIKF4,9590
155
- preditor-0.9.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
156
- preditor-0.9.0.dist-info/entry_points.txt,sha256=mpe0HFD_oIEBNPTJNyUEbmMV6Ivrp4EuYyZ34C5d_PU,519
157
- preditor-0.9.0.dist-info/top_level.txt,sha256=iX1_mrUOky_BQr2oG0l_MbEUYF6idyjiWSzu9z3irIw,9
158
- preditor-0.9.0.dist-info/RECORD,,
153
+ preditor-0.10.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
154
+ preditor-0.10.0.dist-info/METADATA,sha256=aHAm056AxKt_YCBxaBGQBj56-UNN5mAD2zpX--hu_5E,9591
155
+ preditor-0.10.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
156
+ preditor-0.10.0.dist-info/entry_points.txt,sha256=mpe0HFD_oIEBNPTJNyUEbmMV6Ivrp4EuYyZ34C5d_PU,519
157
+ preditor-0.10.0.dist-info/top_level.txt,sha256=iX1_mrUOky_BQr2oG0l_MbEUYF6idyjiWSzu9z3irIw,9
158
+ preditor-0.10.0.dist-info/RECORD,,