[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Minor Kate KJS debug() patch and Python indent script
From:       Massimo Fidanza <max () massimofidanza ! it>
Date:       2008-04-29 0:49:31
Message-ID: 4816709B.8030308 () massimofidanza ! it
[Download RAW message or body]

Hi,

I made change to my patch and now it work for the new version of katescript.
I need to add kateglobal.h in katescript.cpp. I can not test it because 
my test script
where I specified type: command doesn't work. Tell me if it is ok for you.

Thanks
Massimo

Massimo Fidanza ha scritto:
> Ops!!, I just see that things are changed. I need to port my patch to 
> new katepart structure. But I think that I need some help. The only 
> thing that I want is to emit the debug message with the debugScript
> signal.
>
> Please help me, so I can post my plugin after more then a year.
>
> Regards
> Massimo
>
> Massimo Fidanza ha scritto:
>   
>> Hi all,
>>
>> if for you is ok I will release my plugin. The ScriptDebugOutput 
>> plugin will display debug messages
>> in a kate panel. For that I need to patch kdelibs and add a couple of 
>> functions. The debug message
>> will be emitted with the debugScript qt signal and the captured by 
>> ScriptDebugOutput, that will
>> display it in a kate panel.
>> I attach the kdelibs path, if it is ok for you I will post it in the 
>> subversion repository
>>
>> Regards
>> Massimo
>>
>> Dominik Haumann ha scritto:
>>     
>>> Hi Paul,
>>>
>>> On Wednesday 12 March 2008, Paul Giannaros wrote:
>>>  
>>>       
>>>> Hi,
>>>> v
>>>> As it stands, katejscript.cpp causes calls to debug() in JS files to
>>>> be displayed using kDebug. Obviously kDebug output doesn't display if
>>>> a debug build isn't being used, so it's a lot harder to develop new
>>>> indent scripts for those that aren't Kate hackers. This patch makes
>>>> that function use cerr instead. If there are no objections, I'll
>>>> commit it.
>>>>
>>>> I've also attached an indent file for Python. I've been using it a
>>>> little and it seems to work great here. Unless there are any
>>>> objections, I'll import it into SVN.
>>>>
>>>>
>>>> Regards,
>>>> Paul
>>>>     
>>>>         
>>> Please commit.
>>>
>>> Dominik
>>> _______________________________________________
>>> KWrite-Devel mailing list
>>> KWrite-Devel@kde.org
>>> https://mail.kde.org/mailman/listinfo/kwrite-devel
>>>
>>>   
>>>       
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> KWrite-Devel mailing list
>> KWrite-Devel@kde.org
>> https://mail.kde.org/mailman/listinfo/kwrite-devel
>>     
> _______________________________________________
> KWrite-Devel mailing list
> KWrite-Devel@kde.org
> https://mail.kde.org/mailman/listinfo/kwrite-devel
>
>   

["kdelibs.diff" (text/x-patch)]

Index: interfaces/ktexteditor/editor.h
===================================================================
--- interfaces/ktexteditor/editor.h	(revisione 802244)
+++ interfaces/ktexteditor/editor.h	(copia locale)
@@ -237,7 +237,7 @@
      * translated.
      * \param number index of config page
      * \return name of given page index
-	 * \see configPageFullName(), configPagePixmap()
+     * \see configPageFullName(), configPagePixmap()
      */
     virtual QString configPageName (int number) const = 0;
 
@@ -250,7 +250,7 @@
      * something like "Shortcut Configuration".
      * \param number index of config page
      * \return full name of given page index
-	 * \see configPageName(), configPagePixmap()
+     * \see configPageName(), configPagePixmap()
      */
     virtual QString configPageFullName (int number) const = 0;
 
@@ -273,6 +273,13 @@
     void documentCreated (KTextEditor::Editor *editor,
                           KTextEditor::Document *document);
 
+    /**
+     * The \p debugScript emits the message generated by the debug javascript 
+     * function.
+     * \param debug message
+     */
+    void debugScript(const QString&);
+
   private:
     class EditorPrivate* const d;
 };
Index: kate/utils/kateglobal.cpp
===================================================================
--- kate/utils/kateglobal.cpp	(revisione 802244)
+++ kate/utils/kateglobal.cpp	(copia locale)
@@ -393,6 +393,11 @@
   return KIcon("document-properties");
 }
 
+void KateGlobal::debugScriptMsg(const QString& message)
+{
+  emit debugScript(message);
+}
+
 KateGlobal *KateGlobal::self ()
 {
   if (!s_self) {
Index: kate/utils/kateglobal.h
===================================================================
--- kate/utils/kateglobal.h	(revisione 802244)
+++ kate/utils/kateglobal.h	(copia locale)
@@ -152,6 +152,16 @@
     KIcon configPageIcon (int number) const;
 
   /**
+   * Debug
+   */
+  public:
+    /**
+     * Emit debug message via \p debugScript signal
+     * \param message the message to be emitted
+     */
+    void debugScriptMsg(const QString& message);
+
+  /**
    * Kate Part Internal stuff ;)
    */
   public:
Index: kate/script/katescript.cpp
===================================================================
--- kate/script/katescript.cpp	(revisione 802244)
+++ kate/script/katescript.cpp	(copia locale)
@@ -21,6 +21,7 @@
 #include "katescriptview.h"
 #include "kateview.h"
 #include "katedocument.h"
+#include "kateglobal.h"
 
 #include <QFile>
 
@@ -65,6 +66,9 @@
       }
       // debug in blue to distance from other debug output if necessary
       std::cerr << "\033[34m" << qPrintable(message.join(" ")) << "\033[0m\n";
+      // Pass debug message to debugScriptMsg that will emit it with debugScript signal
+      // than the message can be displayed by ScriptDebugOutput plugin
+      KateGlobal::self()->debugScriptMsg(message.join(" "));
       return engine->nullValue();
     }
 


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic