@@ -6,6 +6,8 @@ namespace CADPythonShell
66{
77 public class IronPythonConsoleApp
88 {
9+ public const string RibbonTitle = "Python Shell" ;
10+ public const string RibbonId = "PythonShell" ;
911 [ CommandMethod ( "InitPythonConsole" ) ]
1012 public void Execute ( )
1113 {
@@ -16,32 +18,28 @@ void CreateRibbon()
1618 RibbonControl ribbon = ComponentManager . Ribbon ;
1719 if ( ribbon != null )
1820 {
19- RibbonTab rtab = ribbon . FindTab ( "PythonShell" ) ;
21+ RibbonTab rtab = ribbon . FindTab ( RibbonId ) ;
2022 if ( rtab != null )
2123 {
2224 ribbon . Tabs . Remove ( rtab ) ;
2325 }
2426 rtab = new RibbonTab ( ) ;
25- rtab . Title = "Python Shell" ;
26- rtab . Id = "PythonShell" ;
27- //Add the Tab
27+ rtab . Title = RibbonTitle ;
28+ rtab . Id = RibbonId ;
2829 ribbon . Tabs . Add ( rtab ) ;
29- addContent ( rtab ) ;
30+ AddContentToTab ( rtab ) ;
3031 }
3132 }
32- private void addContent ( RibbonTab rtab )
33+ private void AddContentToTab ( RibbonTab rtab )
3334 {
3435 rtab . Panels . Add ( AddOnePanel ( ) ) ;
3536 }
3637 static RibbonPanel AddOnePanel ( )
3738 {
38- //https://forums.autodesk.com/t5/net/create-custom-ribbon-tab-and-buttons-for-autocad-mechanical-2011/td-p/2834343
3939 RibbonPanelSource rps = new RibbonPanelSource ( ) ;
4040 rps . Title = "Cad Python Shell" ;
4141 RibbonPanel rp = new RibbonPanel ( ) ;
4242 rp . Source = rps ;
43- //Create a Command Item that the Dialog Launcher can use,
44- // for this test it is just a place holder.
4543 RibbonButton rci = new RibbonButton ( ) ;
4644 rci . Name = "Python Shell Console" ;
4745 rps . DialogLauncher = rci ;
@@ -53,6 +51,7 @@ static RibbonPanel AddOnePanel()
5351 rb . Name = "Run CPS" ;
5452 rb . ShowText = true ;
5553 rb . Text = "Run CPS" ;
54+ rb . Description = "Start Write Python Console\n Command: PythonShellConsole" ;
5655 var addinAssembly = typeof ( IronPythonConsoleApp ) . Assembly ;
5756 rb . Image = CADPythonShellApplication . GetEmbeddedPng ( addinAssembly , "CADPythonShell.Resources.Python-16.png" ) ;
5857 rb . LargeImage = CADPythonShellApplication . GetEmbeddedPng ( addinAssembly , "CADPythonShell.Resources.Python-32.png" ) ;
@@ -66,6 +65,7 @@ static RibbonPanel AddOnePanel()
6665 rb2 . Name = "Configure CPS" ;
6766 rb2 . ShowText = true ;
6867 rb2 . Text = "Configure CPS" ;
68+ rb2 . Description = "Configure Cad Python Shell\n Command: PythonShellSetting" ;
6969 rb2 . Image = CADPythonShellApplication . GetEmbeddedPng ( addinAssembly , "CADPythonShell.Resources.Settings-16.png" ) ;
7070 rb2 . LargeImage = CADPythonShellApplication . GetEmbeddedPng ( addinAssembly , "CADPythonShell.Resources.Settings-32.png" ) ;
7171
0 commit comments