Skip to content

Commit 9aa29ce

Browse files
committed
COREUPDATE: Merge branch 'unstable-w12'
IronPython update to 2.7.7 pyRevit usage logging system
2 parents f984b54 + bb6aec6 commit 9aa29ce

File tree

128 files changed

+2868
-833
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2868
-833
lines changed

extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/Extensions.pushbutton/script.py

+4
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ def _update_ext_info_panel(self, ext_pkg_item):
9494
if ext_pkg_item.URL:
9595
self.ext_gitlink_t.Text = '({})'.format(ext_pkg_item.URL)
9696
self.ext_gitlink_hl.NavigateUri = Uri(ext_pkg_item.URL)
97+
else:
98+
self.ext_gitlink_t.Text = ''
9799

98100
# Update the author and profile link
99101
if ext_pkg_item.Author:
100102
self.ext_author_t.Text = ext_pkg_item.Author
101103
self.ext_authorlink_hl.NavigateUri = Uri(ext_pkg_item.ext_pkg.author_profile)
104+
else:
105+
self.ext_author_t.Text = ''
102106

103107
# Update Installed folder info
104108
if ext_pkg_item.ext_pkg.is_installed:

extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/Reload.pushbutton/script.py

+5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
from scriptutils import logger
44
from pyrevit.loader.sessionmgr import load_session
5+
from pyrevit.loader.sessioninfo import get_session_uuid
6+
7+
from scriptutils import this_script
58

69
# re-load pyrevit session.
710
logger.info('Reloading....')
811
load_session()
12+
13+
this_script.results.newsession = get_session_uuid()

extensions/pyRevitCore.extension/pyRevit.tab/pyRevit.panel/Settings.pushbutton/SettingsWindow.xaml

+132-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,78 @@
11
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
Title="pyRevit Settings" Height="630" Width="700" ShowInTaskbar="False" ResizeMode="CanResizeWithGrip"
3+
Title="pyRevit Settings" Height="660" Width="700" ShowInTaskbar="False" ResizeMode="CanResizeWithGrip"
44
WindowStartupLocation="CenterScreen" HorizontalContentAlignment="Center">
5+
<Window.Resources>
6+
<Style x:Key="AnimatedSwitch" TargetType="{x:Type ToggleButton}">
7+
<Setter Property="Foreground" Value="Black" />
8+
<Setter Property="Background" Value="#FAFAFB" />
9+
<Setter Property="BorderBrush" Value="#CCCCCC" />
10+
<Setter Property="Template">
11+
<Setter.Value>
12+
<ControlTemplate TargetType="ToggleButton">
13+
<Viewbox Stretch="Uniform">
14+
<Canvas Name="Layer_1" Width="20" Height="20" Canvas.Left="10" Canvas.Top="0">
15+
<Ellipse Canvas.Left="0" Width="20" Height="20" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
16+
<Ellipse Canvas.Left="15" Width="20" Height="20" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
17+
<Border Canvas.Left="10" Width="15" Height="20" Name="rect416927" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1"/>
18+
<Ellipse x:Name="ellipse" Canvas.Left="0" Width="20" Height="20" Fill="White" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1">
19+
<Ellipse.RenderTransform>
20+
<TranslateTransform X="0" Y="0" />
21+
</Ellipse.RenderTransform>
22+
</Ellipse>
23+
</Canvas>
24+
</Viewbox>
25+
<ControlTemplate.Triggers>
26+
<Trigger Property="IsChecked" Value="True" >
27+
<Trigger.EnterActions>
28+
<BeginStoryboard>
29+
<Storyboard>
30+
<ColorAnimation Storyboard.TargetProperty="Background.Color" To="#52D468" Duration="0:0:0.2" />
31+
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" To="#41C955" Duration="0:0:0.2" />
32+
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Ellipse.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ellipse">
33+
<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
34+
<SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="15" KeySpline="0, 1, 0.6, 1"/>
35+
</DoubleAnimationUsingKeyFrames>
36+
</Storyboard>
37+
</BeginStoryboard>
38+
</Trigger.EnterActions>
39+
<Trigger.ExitActions>
40+
<BeginStoryboard>
41+
<Storyboard>
42+
<ColorAnimation Storyboard.TargetProperty="Background.Color" To="#FAFAFB" Duration="0:0:0.2" />
43+
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" To="#CCCCCC" Duration="0:0:0.2" />
44+
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Ellipse.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ellipse">
45+
<SplineDoubleKeyFrame KeyTime="0" Value="15"/>
46+
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="0" KeySpline="0, 0.5, 0.5, 1"/>
47+
</DoubleAnimationUsingKeyFrames>
48+
</Storyboard>
49+
</BeginStoryboard>
50+
</Trigger.ExitActions>
51+
</Trigger>
52+
</ControlTemplate.Triggers>
53+
</ControlTemplate>
54+
</Setter.Value>
55+
</Setter>
56+
</Style>
57+
<Style TargetType="{x:Type TextBox}">
58+
<Style.Triggers>
59+
<Trigger Property="IsReadOnly" Value="True">
60+
<Setter Property="Background" Value="#d4d9d0" />
61+
<Setter Property="Foreground" Value="#4f693a" />
62+
</Trigger>
63+
</Style.Triggers>
64+
</Style>
65+
</Window.Resources>
566
<ScrollViewer>
667
<StackPanel>
768
<Expander Header="pyRevit Core Settings:" IsExpanded="False" Margin="10px">
869
<StackPanel Margin="10px">
970
<GroupBox Header="Version Control:">
1071
<StackPanel>
11-
<CheckBox x:Name="checkupdates_cb" Margin="10,10,0,10" IsChecked="True">Check updates at startup</CheckBox>
72+
<WrapPanel Margin="10,10,0,10">
73+
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="checkupdates_cb" IsChecked="False"/>
74+
<TextBlock Margin="30,4,0,0">Check updates at startup</TextBlock>
75+
</WrapPanel>
1276
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,10">If activated, pyRevit will check updates for all installed extensions
1377
at Revit startup. If no internet connection is detected, update check will be skipped.</TextBlock>
1478
</StackPanel>
@@ -24,11 +88,11 @@
2488
<RadioButton x:Name="verbose_rb" GroupName="reporting_level" Margin="10,15,0,5" IsChecked="True">Verbose (logging.INFO and above)</RadioButton>
2589
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">Verbose reporting opens the output window and only prints the info messages.
2690
These messages are meant to provide the most basic necessary information about
27-
the current pyRevit session to the user.</TextBlock>
91+
the current pyRevit session to the user.</TextBlock>
2892

2993
<WrapPanel Margin="10,15,0,5">
3094
<Label>If no errors, close startup window after</Label>
31-
<TextBox x:Name="startup_log_timeout" Width="50px" Height="25px"/>
95+
<TextBox x:Name="startup_log_timeout" Width="50px" Height="25px" IsEnabled="{Binding ElementName=verbose_rb, Path=IsChecked}"/>
3296
<Label>seconds. (Set to 0 to keep it open anyways)</Label>
3397
</WrapPanel>
3498

@@ -73,7 +137,10 @@
73137
<GroupBox Header="Development:" Margin="0,10,0,0">
74138
<StackPanel>
75139
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,10,10,0">Misc options for pyRevit development </TextBlock>
76-
<CheckBox x:Name="loadbetatools_cb" Margin="10,10,0,10" IsChecked="False">Load Beta Tools (Ignores beta parameters in scripts, Reload is required)</CheckBox>
140+
<WrapPanel Margin="10,10,0,10">
141+
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="loadbetatools_cb" IsChecked="False"/>
142+
<TextBlock Margin="30,4,0,0">Load Beta Tools (Ignores beta parameters in scripts, Reload is required)</TextBlock>
143+
</WrapPanel>
77144
</StackPanel>
78145
</GroupBox>
79146
</StackPanel>
@@ -96,17 +163,74 @@
96163
are available to scripts. They're used as global flags for setting
97164
reporting mode, and also by scripts (e.g. Sync Views) to set their current toggle state.
98165
These variables are accessible by scripts through scriptutils module.</TextBlock>
99-
<ListView x:Name="envvars_lb" Margin="0,10,0,0" Height="100">
166+
<ListView x:Name="envvars_lb" Margin="0,10,0,0" Height="150">
167+
<ListView.Resources>
168+
<ContextMenu x:Key="ItemContextMenu">
169+
<MenuItem x:Name="menuItem_CopyValue"
170+
Click="copy_envvar_value"
171+
Header="Copy Variable Value">
172+
</MenuItem>
173+
<MenuItem x:Name="menuItem_CopyId"
174+
Click="copy_envvar_id"
175+
Header="Copy Variable Name">
176+
</MenuItem>
177+
</ContextMenu>
178+
</ListView.Resources>
179+
<ListView.ItemContainerStyle>
180+
<Style TargetType="{x:Type ListViewItem}">
181+
<Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}"/>
182+
</Style>
183+
</ListView.ItemContainerStyle>
100184
<ListView.View>
101185
<GridView>
102-
<GridViewColumn Header="Variable Name" Width="410" DisplayMemberBinding="{Binding Id}"/>
103-
<GridViewColumn Header="Value" Width="100" DisplayMemberBinding="{Binding Value}"/>
186+
<GridViewColumn Header="Variable Name" Width="180" DisplayMemberBinding="{Binding Id}"/>
187+
<GridViewColumn Header="Value" DisplayMemberBinding="{Binding Value}"/>
104188
</GridView>
105189
</ListView.View>
106190
</ListView>
107191
</StackPanel>
108192
</Expander>
109193
<Separator Margin="10,0,10,0" Background="#dfdfdf"/>
194+
<Expander Header="Usage Logging:" IsExpanded="False" Margin="10px">
195+
<StackPanel Margin="10px">
196+
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">Usage logging system, records each use of tools under any of the pyRevit extensions.
197+
You can activate usage logging to a local or network folder, or logging to an outside
198+
webserver, or both. If activated, the system will log usage to any of the outputs provided
199+
here. Leave any of the fields blank to disable logging to that destination.</TextBlock>
200+
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,10,10,0">pyRevit creates a new log file for every sesssion to avoid creating large log files that
201+
would potentially slow down the logger. Log files are written in *.JSON format.</TextBlock>
202+
<StackPanel >
203+
<WrapPanel Margin="10,10,10,0">
204+
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="usagelogging_cb" IsChecked="False"/>
205+
<TextBlock Margin="30,4,0,0">Log Tool Usage</TextBlock>
206+
</WrapPanel>
207+
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
208+
<TextBlock DockPanel.Dock="Left">Current usage log file:</TextBlock>
209+
<WrapPanel DockPanel.Dock="Right">
210+
<Button Content="Open Folder" Width="86" Margin="6,0,0,0" Click="open_usagelog_folder" ToolTip="Open the current usage log folder"/>
211+
</WrapPanel>
212+
<TextBox x:Name="cur_usagelogfile_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
213+
</DockPanel>
214+
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
215+
<TextBlock DockPanel.Dock="Left">Log usage to folder (e.g. C:\pyRevitUsageLogs):</TextBlock>
216+
<WrapPanel DockPanel.Dock="Right">
217+
<Button Content="..." Width="40" Margin="6,0,3,0" Click="pick_usagelog_folder" ToolTip="Pick a folder for usage logging"/>
218+
<Button Content="Reset" Width="40" Margin="3,0,0,0" Click="reset_usagelog_folder" ToolTip="Reset usage logging folder back to default"/>
219+
</WrapPanel>
220+
<TextBox x:Name="usagelogfile_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
221+
</DockPanel>
222+
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
223+
<TextBlock DockPanel.Dock="Left">Current usage server url:</TextBlock>
224+
<TextBox x:Name="cur_usageserverurl_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
225+
</DockPanel>
226+
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
227+
<TextBlock DockPanel.Dock="Left">Log usage to webserver (e.g. http://logserver.io):</TextBlock>
228+
<TextBox x:Name="usagelogserver_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
229+
</DockPanel>
230+
</StackPanel>
231+
</StackPanel>
232+
</Expander>
233+
<Separator Margin="10,0,10,0" Background="#dfdfdf"/>
110234
<Expander Header="Custom user extension folders:" IsExpanded="True" Margin="10px">
111235
<StackPanel Margin="10px">
112236
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">pyRevit can search in custom folders for extensions.

0 commit comments

Comments
 (0)