Skip to content

Commit

Permalink
COREUPDATE: Merge branch 'unstable-w12'
Browse files Browse the repository at this point in the history
IronPython update to 2.7.7
pyRevit usage logging system
  • Loading branch information
eirannejad committed Apr 1, 2017
2 parents f984b54 + bb6aec6 commit 9aa29ce
Show file tree
Hide file tree
Showing 128 changed files with 2,868 additions and 833 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ def _update_ext_info_panel(self, ext_pkg_item):
if ext_pkg_item.URL:
self.ext_gitlink_t.Text = '({})'.format(ext_pkg_item.URL)
self.ext_gitlink_hl.NavigateUri = Uri(ext_pkg_item.URL)
else:
self.ext_gitlink_t.Text = ''

# Update the author and profile link
if ext_pkg_item.Author:
self.ext_author_t.Text = ext_pkg_item.Author
self.ext_authorlink_hl.NavigateUri = Uri(ext_pkg_item.ext_pkg.author_profile)
else:
self.ext_author_t.Text = ''

# Update Installed folder info
if ext_pkg_item.ext_pkg.is_installed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

from scriptutils import logger
from pyrevit.loader.sessionmgr import load_session
from pyrevit.loader.sessioninfo import get_session_uuid

from scriptutils import this_script

# re-load pyrevit session.
logger.info('Reloading....')
load_session()

this_script.results.newsession = get_session_uuid()
Original file line number Diff line number Diff line change
@@ -1,14 +1,78 @@
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="pyRevit Settings" Height="630" Width="700" ShowInTaskbar="False" ResizeMode="CanResizeWithGrip"
Title="pyRevit Settings" Height="660" Width="700" ShowInTaskbar="False" ResizeMode="CanResizeWithGrip"
WindowStartupLocation="CenterScreen" HorizontalContentAlignment="Center">
<Window.Resources>
<Style x:Key="AnimatedSwitch" TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="#FAFAFB" />
<Setter Property="BorderBrush" Value="#CCCCCC" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Viewbox Stretch="Uniform">
<Canvas Name="Layer_1" Width="20" Height="20" Canvas.Left="10" Canvas.Top="0">
<Ellipse Canvas.Left="0" Width="20" Height="20" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
<Ellipse Canvas.Left="15" Width="20" Height="20" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
<Border Canvas.Left="10" Width="15" Height="20" Name="rect416927" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1"/>
<Ellipse x:Name="ellipse" Canvas.Left="0" Width="20" Height="20" Fill="White" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1">
<Ellipse.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Ellipse.RenderTransform>
</Ellipse>
</Canvas>
</Viewbox>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True" >
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color" To="#52D468" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" To="#41C955" Duration="0:0:0.2" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Ellipse.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ellipse">
<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="15" KeySpline="0, 1, 0.6, 1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color" To="#FAFAFB" Duration="0:0:0.2" />
<ColorAnimation Storyboard.TargetProperty="BorderBrush.Color" To="#CCCCCC" Duration="0:0:0.2" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Ellipse.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ellipse">
<SplineDoubleKeyFrame KeyTime="0" Value="15"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="0" KeySpline="0, 0.5, 0.5, 1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="Background" Value="#d4d9d0" />
<Setter Property="Foreground" Value="#4f693a" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<ScrollViewer>
<StackPanel>
<Expander Header="pyRevit Core Settings:" IsExpanded="False" Margin="10px">
<StackPanel Margin="10px">
<GroupBox Header="Version Control:">
<StackPanel>
<CheckBox x:Name="checkupdates_cb" Margin="10,10,0,10" IsChecked="True">Check updates at startup</CheckBox>
<WrapPanel Margin="10,10,0,10">
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="checkupdates_cb" IsChecked="False"/>
<TextBlock Margin="30,4,0,0">Check updates at startup</TextBlock>
</WrapPanel>
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,10">If activated, pyRevit will check updates for all installed extensions
at Revit startup. If no internet connection is detected, update check will be skipped.</TextBlock>
</StackPanel>
Expand All @@ -24,11 +88,11 @@
<RadioButton x:Name="verbose_rb" GroupName="reporting_level" Margin="10,15,0,5" IsChecked="True">Verbose (logging.INFO and above)</RadioButton>
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">Verbose reporting opens the output window and only prints the info messages.
These messages are meant to provide the most basic necessary information about
the current pyRevit session to the user.</TextBlock>
the current pyRevit session to the user.</TextBlock>

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

Expand Down Expand Up @@ -73,7 +137,10 @@
<GroupBox Header="Development:" Margin="0,10,0,0">
<StackPanel>
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,10,10,0">Misc options for pyRevit development </TextBlock>
<CheckBox x:Name="loadbetatools_cb" Margin="10,10,0,10" IsChecked="False">Load Beta Tools (Ignores beta parameters in scripts, Reload is required)</CheckBox>
<WrapPanel Margin="10,10,0,10">
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="loadbetatools_cb" IsChecked="False"/>
<TextBlock Margin="30,4,0,0">Load Beta Tools (Ignores beta parameters in scripts, Reload is required)</TextBlock>
</WrapPanel>
</StackPanel>
</GroupBox>
</StackPanel>
Expand All @@ -96,17 +163,74 @@
are available to scripts. They're used as global flags for setting
reporting mode, and also by scripts (e.g. Sync Views) to set their current toggle state.
These variables are accessible by scripts through scriptutils module.</TextBlock>
<ListView x:Name="envvars_lb" Margin="0,10,0,0" Height="100">
<ListView x:Name="envvars_lb" Margin="0,10,0,0" Height="150">
<ListView.Resources>
<ContextMenu x:Key="ItemContextMenu">
<MenuItem x:Name="menuItem_CopyValue"
Click="copy_envvar_value"
Header="Copy Variable Value">
</MenuItem>
<MenuItem x:Name="menuItem_CopyId"
Click="copy_envvar_id"
Header="Copy Variable Name">
</MenuItem>
</ContextMenu>
</ListView.Resources>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Header="Variable Name" Width="410" DisplayMemberBinding="{Binding Id}"/>
<GridViewColumn Header="Value" Width="100" DisplayMemberBinding="{Binding Value}"/>
<GridViewColumn Header="Variable Name" Width="180" DisplayMemberBinding="{Binding Id}"/>
<GridViewColumn Header="Value" DisplayMemberBinding="{Binding Value}"/>
</GridView>
</ListView.View>
</ListView>
</StackPanel>
</Expander>
<Separator Margin="10,0,10,0" Background="#dfdfdf"/>
<Expander Header="Usage Logging:" IsExpanded="False" Margin="10px">
<StackPanel Margin="10px">
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">Usage logging system, records each use of tools under any of the pyRevit extensions.
You can activate usage logging to a local or network folder, or logging to an outside
webserver, or both. If activated, the system will log usage to any of the outputs provided
here. Leave any of the fields blank to disable logging to that destination.</TextBlock>
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,10,10,0">pyRevit creates a new log file for every sesssion to avoid creating large log files that
would potentially slow down the logger. Log files are written in *.JSON format.</TextBlock>
<StackPanel >
<WrapPanel Margin="10,10,10,0">
<ToggleButton Style="{StaticResource AnimatedSwitch}" Height="24" x:Name="usagelogging_cb" IsChecked="False"/>
<TextBlock Margin="30,4,0,0">Log Tool Usage</TextBlock>
</WrapPanel>
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
<TextBlock DockPanel.Dock="Left">Current usage log file:</TextBlock>
<WrapPanel DockPanel.Dock="Right">
<Button Content="Open Folder" Width="86" Margin="6,0,0,0" Click="open_usagelog_folder" ToolTip="Open the current usage log folder"/>
</WrapPanel>
<TextBox x:Name="cur_usagelogfile_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
</DockPanel>
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
<TextBlock DockPanel.Dock="Left">Log usage to folder (e.g. C:\pyRevitUsageLogs):</TextBlock>
<WrapPanel DockPanel.Dock="Right">
<Button Content="..." Width="40" Margin="6,0,3,0" Click="pick_usagelog_folder" ToolTip="Pick a folder for usage logging"/>
<Button Content="Reset" Width="40" Margin="3,0,0,0" Click="reset_usagelog_folder" ToolTip="Reset usage logging folder back to default"/>
</WrapPanel>
<TextBox x:Name="usagelogfile_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
</DockPanel>
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
<TextBlock DockPanel.Dock="Left">Current usage server url:</TextBlock>
<TextBox x:Name="cur_usageserverurl_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
</DockPanel>
<DockPanel Margin="10,10,10,0" IsEnabled="{Binding ElementName=usagelogging_cb, Path=IsChecked}">
<TextBlock DockPanel.Dock="Left">Log usage to webserver (e.g. http://logserver.io):</TextBlock>
<TextBox x:Name="usagelogserver_tb" FontFamily="Courier New" Margin="15,0,0,0" Height="20"/>
</DockPanel>
</StackPanel>
</StackPanel>
</Expander>
<Separator Margin="10,0,10,0" Background="#dfdfdf"/>
<Expander Header="Custom user extension folders:" IsExpanded="True" Margin="10px">
<StackPanel Margin="10px">
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,0,10,0">pyRevit can search in custom folders for extensions.
Expand Down
Loading

0 comments on commit 9aa29ce

Please sign in to comment.