Page 2 of 4

Re: New version 0.5.0-rc6 is out

Posted: Tue Jan 15, 2019 9:53 pm
by Radar73
Yeah it works fine calling the application with -e … I wasn't doing anything complicated with the Eventghost object in vbscript anyways so this works just as well. Is there anyway to prevent the addition of "Main" being added to the event name? For example I sent it eventghost.exe -e "Hello" and it shows up in the log as Main.Hello instead of just Hello.

Re: New version 0.5.0-rc6 is out

Posted: Sat Feb 02, 2019 3:42 am
by blaher
I'm having problems getting this to run on startup. It appears in shell:startup, but even after making it always run as admin, it doesn't. Shortcut works fine when I click when windows has loaded, but .bat files, shortcuts to .bat files, dragging EG from shell:appsfolder to startup...none of them work.

Edit: finally got in running with taskscheduler running a .bat file with highest privileges when a user logs on.

Re: New version 0.5.0-rc6 is out

Posted: Sat Feb 02, 2019 7:32 am
by kgschlosser
I can't remember off hand but I think if you specify an event name with a '.' in it then the Main will go away

like Some.Event

the reason for that logic is this.. the Prefix would be event grouping. and the suffix is what is taking place for that grouping.. so if you have a plugin for your TV.. the event would be TV.Power this lets you know 2 things.. what is generating the event. and what the event is. the '.' is also how you do wild carded events.

say you have an Audio Processor that is connected to EG and it generates events for Mute, Volume, changes in the tone.. things of that nature. and you wanted to have an OSD shown.. you can create a single macro and add an event with the prefix followed by .* this will cause all events from the Audio Processor to run the macro.

So as a rule of thumb.. events should always be prefix.suffix hence the reason why EG is adding the Main

Re: New version 0.5.0-rc6 is out

Posted: Fri Feb 08, 2019 3:30 pm
by topix
blaher wrote:
Sat Feb 02, 2019 3:42 am
I'm having problems getting this to run on startup. It appears in shell:startup, but even after making it always run as admin, it doesn't. Shortcut works fine when I click when windows has loaded, but .bat files, shortcuts to .bat files, dragging EG from shell:appsfolder to startup...none of them work.

Edit: finally got in running with taskscheduler running a .bat file with highest privileges when a user logs on.
Also you have a solution for you problem, i would be interested if it could be something with your config. May i ask you to try again with an empty config tree an then enable the autostart option in EventGhost's settings?

Error opening EG Options

Posted: Sat Mar 09, 2019 5:44 pm
by cableghost
Receive error on trying to access Options...

Code: Select all

2:22:43 AM   Traceback (most recent call last) (0.5.0-rc6):
2:22:43 AM     File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
2:22:43 AM       self.Configure(*args, **kwargs)
2:22:43 AM     File "C:\Program Files (x86)\EventGhost\eg\Classes\OptionsDialog.py", line 194, in Configure
2:22:43 AM       languageChoice.SetSelection(languageList.index(config.language))
2:22:43 AM   ValueError: 'en_US' is not in list
Tasklet:

Code: Select all

# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2 of the License, or (at your option)
# any later version.
#
# EventGhost is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with EventGhost. If not, see <http://www.gnu.org/licenses/>.

"""
    eg.Tasklet
    ~~~~~~~~~~

    A wrapper around stackless.tasklet

    :copyright: 2009 by EventGhost team, see AUTHORS.txt for more details.
    :license: GNU GPL v2, see LICENSE.txt for more details.
"""

import stackless

class Tasklet(stackless.tasklet):
    countTasklets = 0

    def __init__(self, func):
        stackless.tasklet.__init__(self)
        self.bind(func)
        Tasklet.countTasklets += 1
        self.taskId = Tasklet.countTasklets

    @classmethod
    def GetCurrentId(cls):
        try:
            return stackless.getcurrent().taskId
        except AttributeError:
            return 0
OptionsDialog:

Code: Select all

# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2 of the License, or (at your option)
# any later version.
#
# EventGhost is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with EventGhost. If not, see <http://www.gnu.org/licenses/>.

import os
import wx
from os.path import exists, join
from time import localtime, strftime
from wx.combo import BitmapComboBox

# Local imports
import eg

INDENT_WIDTH = 18

class Text(eg.TranslatableStrings):
    Title = "Options"
    Tab1 = "General"
    CheckPreRelease = "Always notify about new pre-releases"
    CheckUpdate = "Check for EventGhost updates at launch"
    confirmDelete = "Confirm deletion of tree items"
    confirmRestart = (
        "Language changes only take effect after restarting the application."
        "\n\n"
        "Do you want to restart EventGhost now?"
    )
    Datestamp = "Datestamp format for log:"
    DatestampHelp = (
        "For imformation on format codes read Python's strftime "
        "documentation:\n"
        "http://docs.python.org/2/library/datetime.html#strftime-and-strptime-"
        "behavior\n"
        "\nHere you can find examples:\n"
        "http://strftime.org/\n"
    )
    HideOnClose = "Keep running in background when window closed"
    HideOnStartup = "Hide on startup"
    LanguageGroup = "Language"
    limitMemory1 = "Limit memory consumption while minimized to"
    limitMemory2 = "MB"
    propResize = "Resize window proportionally"
    refreshEnv = 'Refresh environment before executing "Run" actions'
    showTrayIcon = "Display EventGhost icon in system tray"
    StartWithWindows = 'Autostart EventGhost for user "%s"' % os.environ["USERNAME"]
    UseAutoloadFile = "Autoload file"
    UseFixedFont = 'Use fixed-size font in the "Log" pane'


class OptionsDialog(eg.TaskletDialog):
    instance = None

    @eg.LogItWithReturn
    def Configure(self, parent=None):
        if OptionsDialog.instance:
            OptionsDialog.instance.Raise()
            return
        OptionsDialog.instance = self

        text = Text
        config = eg.config
        self.useFixedFont = config.useFixedFont

        eg.TaskletDialog.__init__(
            self,
            parent=parent,
            title=text.Title,
        )

        languageNames = eg.Translation.languageNames
        languageList = ["en_EN"]
        for item in os.listdir(eg.languagesDir):
            name, ext = os.path.splitext(item)
            if ext == ".py" and name in languageNames:
                languageList.append(name)
        languageList.sort()
        languageNameList = [languageNames[x] for x in languageList]
        notebook = wx.Notebook(self, -1)
        page1 = eg.Panel(notebook)
        notebook.AddPage(page1, text.Tab1)

        # page 1 controls
        startWithWindowsCtrl = page1.CheckBox(
            exists(join((eg.folderPath.Startup or ""), eg.APP_NAME + ".lnk")),
            text.StartWithWindows
        )
        if eg.folderPath.Startup is None:
            startWithWindowsCtrl.Enable(False)

        checkUpdateCtrl = page1.CheckBox(config.checkUpdate, text.CheckUpdate)
        checkPreReleaseCtrl = page1.CheckBox(config.checkPreRelease, text.CheckPreRelease)
        checkPreReleaseCtrl.Enable(config.checkUpdate)

        def OnCheckUpdateCheckBox(event):
            checkPreReleaseCtrl.Enable(event.IsChecked())
        checkUpdateCtrl.Bind(wx.EVT_CHECKBOX, OnCheckUpdateCheckBox)

        confirmDeleteCtrl = page1.CheckBox(
            config.confirmDelete,
            text.confirmDelete
        )

        showTrayIconCtrl = page1.CheckBox(
            config.showTrayIcon,
            text.showTrayIcon
        )

        hideOnCloseCtrl = page1.CheckBox(
            config.hideOnClose,
            text.HideOnClose
        )

        memoryLimitCtrl = page1.CheckBox(config.limitMemory, text.limitMemory1)
        memoryLimitSpinCtrl = page1.SpinIntCtrl(
            config.limitMemorySize,
            min=4,
            max=999
        )

        def OnMemoryLimitCheckBox(dummyEvent):
            memoryLimitSpinCtrl.Enable(memoryLimitCtrl.IsChecked())
        memoryLimitCtrl.Bind(wx.EVT_CHECKBOX, OnMemoryLimitCheckBox)
        OnMemoryLimitCheckBox(None)

        refreshEnvCtrl = page1.CheckBox(
            config.refreshEnv,
            text.refreshEnv
        )

        propResizeCtrl = page1.CheckBox(
            config.propResize,
            text.propResize
        )

        useFixedFontCtrl = page1.CheckBox(
            config.useFixedFont,
            text.UseFixedFont
        )

        def OnFixedFontBox(evt):
            self.UpdateFont(evt.IsChecked())
        useFixedFontCtrl.Bind(wx.EVT_CHECKBOX, OnFixedFontBox)

        datestampCtrl = page1.TextCtrl(config.datestamp)
        datestampCtrl.SetToolTipString(text.DatestampHelp)
        datestampLabel = page1.StaticText(text.Datestamp)
        datestampLabel.SetToolTipString(text.DatestampHelp)
        datestampSzr = wx.BoxSizer(wx.HORIZONTAL)
        datestampSzr.AddMany((
            (datestampLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
            (datestampCtrl, 1, wx.EXPAND)
        ))

        def OnDatestampKillFocus(_):
            dt_fmt = datestampCtrl.GetValue()
            try:
                strftime(dt_fmt, localtime())
            except ValueError:
                wx.MessageBox("Invalid format string!", "Error")
                datestampCtrl.SetBackgroundColour("pink")
                datestampCtrl.Refresh()
                wx.CallAfter(datestampCtrl.SetFocus)
            else:
                datestampCtrl.SetBackgroundColour(
                    wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
                )
                datestampCtrl.Refresh()

        datestampCtrl.Bind(wx.EVT_KILL_FOCUS, OnDatestampKillFocus)

        languageChoice = BitmapComboBox(page1, style=wx.CB_READONLY)
        for name, code in zip(languageNameList, languageList):
            filename = os.path.join(eg.imagesDir, "flags", "%s.png" % code)
            if os.path.exists(filename):
                image = wx.Image(filename)
                image.Resize((16, 16), (0, 3))
                bmp = image.ConvertToBitmap()
                languageChoice.Append(name, bmp)
            else:
                languageChoice.Append(name)
        languageChoice.SetSelection(languageList.index(config.language))
        languageChoice.SetMinSize((150, -1))

        buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL))

        # construction of the layout with sizers

        flags = wx.ALIGN_CENTER_VERTICAL
        memoryLimitSizer = eg.HBoxSizer(
            (memoryLimitCtrl, 0, flags),
            (memoryLimitSpinCtrl, 0, flags),
            (page1.StaticText(text.limitMemory2), 0, flags | wx.LEFT, 2),
        )

        startGroupSizer = wx.GridSizer(cols=1, vgap=2, hgap=2)
        startGroupSizer.AddMany(
            (
                (startWithWindowsCtrl, 0, flags),
                (checkUpdateCtrl, 0, flags),
                (checkPreReleaseCtrl, 0, flags | wx.LEFT, INDENT_WIDTH),
                (confirmDeleteCtrl, 0, flags),
                (showTrayIconCtrl, 0, flags),
                (hideOnCloseCtrl, 0, flags),
                (memoryLimitSizer, 0, flags),
                (refreshEnvCtrl, 0, flags),
                (propResizeCtrl, 0, flags),
                (useFixedFontCtrl, 0, flags),
                (datestampSzr, 0, flags),
            )
        )

        langGroupSizer = page1.VStaticBoxSizer(
            text.LanguageGroup,
            (languageChoice, 0, wx.LEFT | wx.RIGHT, INDENT_WIDTH),
        )

        page1Sizer = eg.VBoxSizer(
            ((15, 7), 1),
            (startGroupSizer, 0, wx.EXPAND | wx.ALL, 5),
            ((15, 7), 1),
            (langGroupSizer, 0, wx.EXPAND | wx.ALL, 5),
        )
        page1.SetSizer(page1Sizer)
        page1.SetAutoLayout(True)

        sizer = eg.VBoxSizer(
            (notebook, 1, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5),
            (buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizerAndFit(sizer)
        self.SetMinSize(self.GetSize())
        notebook.ChangeSelection(0)

        oldLanguage = config.language

        while self.Affirmed():
            config.checkUpdate = checkUpdateCtrl.GetValue()
            config.checkPreRelease = checkPreReleaseCtrl.GetValue()
            config.confirmDelete = confirmDeleteCtrl.GetValue()
            config.showTrayIcon = showTrayIconCtrl.GetValue()
            config.hideOnClose = hideOnCloseCtrl.GetValue()
            config.limitMemory = bool(memoryLimitCtrl.GetValue())
            config.limitMemorySize = memoryLimitSpinCtrl.GetValue()
            config.refreshEnv = refreshEnvCtrl.GetValue()
            config.propResize = propResizeCtrl.GetValue()
            config.useFixedFont = useFixedFontCtrl.GetValue()
            config.datestamp = datestampCtrl.GetValue()
            config.language = languageList[languageChoice.GetSelection()]
            config.Save()
            self.SetResult()

        eg.Utils.UpdateStartupShortcut(startWithWindowsCtrl.GetValue())

        if config.showTrayIcon:
            eg.taskBarIcon.Show()
        else:
            eg.taskBarIcon.Hide()

        if eg.mainFrame:
            eg.mainFrame.SetWindowStyleFlag()
            eg.mainFrame.logCtrl.SetDTLogging()

        if config.language != oldLanguage:
            wx.CallAfter(self.ShowLanguageWarning)

        OptionsDialog.instance = None

    @eg.LogItWithReturn
    def OnCancel(self, event):
        self.UpdateFont(self.useFixedFont)
        self.DispatchEvent(event, wx.ID_CANCEL)

    @eg.LogItWithReturn
    def OnClose(self, event):
        self.UpdateFont(self.useFixedFont)
        self.DispatchEvent(event, wx.ID_CANCEL)

    def ShowLanguageWarning(self):
        dlg = wx.MessageDialog(
            eg.document.frame,
            Text.confirmRestart,
            "",
            wx.YES_NO | wx.ICON_QUESTION
        )
        res = dlg.ShowModal()
        dlg.Destroy()
        if res == wx.ID_YES:
            eg.app.Restart()

    def UpdateFont(self, val):
        font = eg.document.frame.treeCtrl.GetFont()
        if val:
            font = wx.Font(font.GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, "Courier New")
        wx.CallAfter(eg.document.frame.logCtrl.SetFont, font)

Re: New version 0.5.0-rc6 is out

Posted: Sun Mar 10, 2019 1:06 am
by molitar
I am unable to use options menu at all. I can not set it to not close on x.

When I try to use options I get the following error.
---> Welcome to EventGhost <---
Traceback (most recent call last) (0.5.0-rc6):
File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
self.Configure(*args, **kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\OptionsDialog.py", line 194, in Configure
languageChoice.SetSelection(languageList.index(config.language))
ValueError: 'en_US' is not in list

Re: New version 0.5.0-rc6 is out

Posted: Tue Mar 12, 2019 8:39 pm
by kgschlosser
@molitar

replace the file

Code: Select all

C:\Program Files (x86)\EventGhost\eg\Classes\OptionsDialog.py
with the one that is attached

Re: New version 0.5.0-rc6 is out

Posted: Tue Mar 12, 2019 10:32 pm
by cableghost
kgschlosser wrote:
Tue Mar 12, 2019 8:39 pm
@molitar

replace the file

Code: Select all

C:\Program Files (x86)\EventGhost\eg\Classes\OptionsDialog.py
with the one that is attached
I'm still receiving the error mentioned above after shutting EG down, replacing file and restarting.

Re: New version 0.5.0-rc6 is out

Posted: Tue Mar 12, 2019 10:53 pm
by kgschlosser
post the error for me please

Re: New version 0.5.0-rc6 is out

Posted: Tue Mar 12, 2019 10:58 pm
by kgschlosser
this iis the code for the originial OptionsDialog.py

Code: Select all


class OptionsDialog(eg.TaskletDialog):
    instance = None

    @eg.LogItWithReturn
    def Configure(self, parent=None):
        if OptionsDialog.instance:
            OptionsDialog.instance.Raise()
            return
        OptionsDialog.instance = self

        text = Text
        config = eg.config
        self.useFixedFont = config.useFixedFont

        eg.TaskletDialog.__init__(
            self,
            parent=parent,
            title=text.Title,
        )

        languageNames = eg.Translation.languageNames
        languageList = ["en_EN"]                                           <<<<<<<<<<<<<<<<<<< OLD
        for item in os.listdir(eg.languagesDir):
            name, ext = os.path.splitext(item)
            if ext == ".py" and name in languageNames:
                languageList.append(name)
        languageList.sort()
and this is the same block of code but has been updated for the en_US language

Code: Select all

class OptionsDialog(eg.TaskletDialog):
    instance = None

    @eg.LogItWithReturn
    def Configure(self, parent=None):
        if OptionsDialog.instance:
            OptionsDialog.instance.Raise()
            return
        OptionsDialog.instance = self

        text = Text
        config = eg.config
        self.useFixedFont = config.useFixedFont

        eg.TaskletDialog.__init__(
            self,
            parent=parent,
            title=text.Title,
        )

        languageNames = eg.Translation.languageNames
        languageList = ["en_US"]                                 <<<<<<<<<<<<<<<<<<< NEW
        for item in os.listdir(eg.languagesDir):
            name, ext = os.path.splitext(item)
            if ext == ".py" and name in languageNames:
                languageList.append(name)
        languageList.sort()

as you can see I made the change. so the same error should not be occurring.

Re: New version 0.5.0-rc6 is out

Posted: Tue Mar 12, 2019 11:35 pm
by cableghost
kgschlosser wrote:
Tue Mar 12, 2019 10:53 pm
post the error for me please

Code: Select all

6:34:14 PM   Traceback (most recent call last) (0.5.0-rc6):
6:34:14 PM     File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
6:34:14 PM       self.Configure(*args, **kwargs)
6:34:14 PM     File "C:\Program Files (x86)\EventGhost\eg\Classes\OptionsDialog.py", line 194, in Configure
6:34:14 PM       languageChoice.SetSelection(languageList.index(config.language))
6:34:14 PM   ValueError: 'en_US' is not in list
EG 0.5.0-rc6

Re: New version 0.5.0-rc6 is out

Posted: Wed Mar 13, 2019 1:10 am
by kgschlosser
with a text editor like sublime text or notepad++ not notepad and not wordpad open up OptionsDialog.py.

do a search for

Code: Select all

languageList = ["en_EN"]
if it finds it replace the en_EN with en_US

Re: New version 0.5.0-rc6 is out

Posted: Fri Mar 15, 2019 12:50 am
by molitar
I found some fatal bugs with this new version. I decided to start off new to see if it would fix the random problems I been having.

Fresh brand new install and added three plugins and none of my events would work with MPC-Home not even volume control or OSD Show. I then took my backup of the entire plugins folder and overwrote EVERY single plugin with the latest 0.4 version and everything worked perfectly! The new plugins break everything!

I have attached a copy of my default.xml that I am using with the 3 added plugins which is Media Player Classic 2.1.3, Taskbar 1.0.0, and DX USB Remote.

Please see if you can figure out why the new plugins break everything to do with Media Player Classic with attached files.

Re: New version 0.5.0-rc6 is out

Posted: Fri Mar 15, 2019 6:16 pm
by kgschlosser
are you getting any errors?

Re: New version 0.5.0-rc6 is out

Posted: Fri Mar 15, 2019 6:19 pm
by kgschlosser
So you say that older versions of the plugins work? or an older version of EG?

if it is older versions of the plugins I am goiign to need the older ones as well as the newer ones that do not work. I need to compare the 2 side by side to see what has changed,