Skip to content

Commit

Permalink
add set_font_sizes , some IDE PEP8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hdm-dt-fb committed Apr 3, 2018
1 parent 2111975 commit 239d84a
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions RevitPythonShell/DefaultConfig/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,29 @@ def get_selected_elements(doc):
except:
# old method
return list(__revit__.ActiveUIDocument.Selection.Elements)


selection = get_selected_elements(doc)
# convenience variable for first element in selection
if len(selection):
s0 = selection[0]

#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
import clr
from Autodesk.Revit.DB import ElementSet, ElementId


class RevitLookup(object):
def __init__(self, uiApplication):
'''
"""
for RevitSnoop to function properly, it needs to be instantiated
with a reference to the Revit Application object.
'''
"""
# find the RevitLookup plugin
try:
rlapp = [app for app in uiApplication.LoadedApplications
if app.GetType().Namespace == 'RevitLookup'
and app.GetType().Name == 'App'][0]
rlapp = [app for app in uiApplication.LoadedApplications
if app.GetType().Namespace == 'RevitLookup'
and app.GetType().Name == 'App'][0]
except IndexError:
self.RevitLookup = None
return
Expand All @@ -62,8 +65,8 @@ def __init__(self, uiApplication):

def lookup(self, element):
if not self.RevitLookup:
print 'RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.'
return
print('RevitLookup not installed. Visit https://github.com/jeremytammik/RevitLookup to install.')
return
if isinstance(element, int):
element = self.revit.ActiveUIDocument.Document.GetElement(ElementId(element))
if isinstance(element, ElementId):
Expand All @@ -75,11 +78,16 @@ def lookup(self, element):
element = elementSet
form = self.RevitLookup.Snoop.Forms.Objects(element)
form.ShowDialog()


_revitlookup = RevitLookup(__revit__)


def lookup(element):
_revitlookup.lookup(element)

#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------


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

def __getattr__(self, name):
return getattr(self.win, name)

def set_font_sizes(self, size):
self.rps_repl = self.win.Content.Children[0].Children[0].Content.Children[0]
self.rps_editor = self.win.Content.Children[2].Children[1].Children[0]
self.rps_repl.FontSize = size
self.rps_editor.FontSize = size


__window__ = WindowWrapper(__window__)

0 comments on commit 239d84a

Please sign in to comment.