Skip to content

Commit a3a293e

Browse files
authored
Merge pull request #77 from hdm-dt-fb/repl_font
add set_font_sizes , some IDE PEP8 fixes
2 parents 2f1591b + 239d84a commit a3a293e

File tree

1 file changed

+25
-9
lines changed
  • RevitPythonShell/DefaultConfig

1 file changed

+25
-9
lines changed

RevitPythonShell/DefaultConfig/init.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,29 @@ def get_selected_elements(doc):
2929
except:
3030
# old method
3131
return list(__revit__.ActiveUIDocument.Selection.Elements)
32+
33+
3234
selection = get_selected_elements(doc)
3335
# convenience variable for first element in selection
3436
if len(selection):
3537
s0 = selection[0]
3638

37-
#------------------------------------------------------------------------------
39+
# ------------------------------------------------------------------------------
3840
import clr
3941
from Autodesk.Revit.DB import ElementSet, ElementId
4042

43+
4144
class RevitLookup(object):
4245
def __init__(self, uiApplication):
43-
'''
46+
"""
4447
for RevitSnoop to function properly, it needs to be instantiated
4548
with a reference to the Revit Application object.
46-
'''
49+
"""
4750
# find the RevitLookup plugin
4851
try:
49-
rlapp = [app for app in uiApplication.LoadedApplications
50-
if app.GetType().Namespace == 'RevitLookup'
51-
and app.GetType().Name == 'App'][0]
52+
rlapp = [app for app in uiApplication.LoadedApplications
53+
if app.GetType().Namespace == 'RevitLookup'
54+
and app.GetType().Name == 'App'][0]
5255
except IndexError:
5356
self.RevitLookup = None
5457
return
@@ -62,8 +65,8 @@ def __init__(self, uiApplication):
6265

6366
def lookup(self, element):
6467
if not self.RevitLookup:
65-
print 'RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.'
66-
return
68+
print('RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.')
69+
return
6770
if isinstance(element, int):
6871
element = self.revit.ActiveUIDocument.Document.GetElement(ElementId(element))
6972
if isinstance(element, ElementId):
@@ -75,11 +78,16 @@ def lookup(self, element):
7578
element = elementSet
7679
form = self.RevitLookup.Snoop.Forms.Objects(element)
7780
form.ShowDialog()
81+
82+
7883
_revitlookup = RevitLookup(__revit__)
84+
85+
7986
def lookup(element):
8087
_revitlookup.lookup(element)
8188

82-
#------------------------------------------------------------------------------
89+
# ------------------------------------------------------------------------------
90+
8391

8492
# a fix for the __window__.Close() bug introduced with the non-modal console
8593
class WindowWrapper(object):
@@ -91,4 +99,12 @@ def Close(self):
9199

92100
def __getattr__(self, name):
93101
return getattr(self.win, name)
102+
103+
def set_font_sizes(self, size):
104+
self.rps_repl = self.win.Content.Children[0].Children[0].Content.Children[0]
105+
self.rps_editor = self.win.Content.Children[2].Children[1].Children[0]
106+
self.rps_repl.FontSize = size
107+
self.rps_editor.FontSize = size
108+
109+
94110
__window__ = WindowWrapper(__window__)

0 commit comments

Comments
 (0)