Project

General

Profile

Bug #128 » xbmc4xbox-weather.4.diff

nuka1195, 18/01/2011 04:46 AM

View differences:

scripts/.modules/script.module.weather/lib/xbmcweather/search.py (working copy)
if ( self.index == "_geo" ):
return town
# open settings for non ip based geo location search
self.Addon.openSettings()
##self.Addon.openSettings()
def _get_search_text( self, default="", heading="", hidden=False ):
""" shows a keyboard and returns a value """
scripts/.modules/script.module.weather/lib/xbmcweather/weather.py (working copy)
self.WINDOW.setProperty( "Day%s.Date" % ( day[ 0 ], ), self.localize_unit( day[ 2 ], "monthdate", long=True ) )# Days date (eg. October 1)
self.WINDOW.setProperty( "Day%s.DateShort" % ( day[ 0 ], ), self.localize_unit( day[ 2 ], "monthdate" ) )# Days abbreviated date (eg. Oct 1)
self.WINDOW.setProperty( "Day%s.LowTemperature" % ( day[ 0 ], ), self.localize_unit( day[ 4 ] ) )# Days low temperature (eg. 50)
self.WINDOW.setProperty( "Day%s.LowTemp" % ( day[ 0 ], ), self.localize_unit( day[ 4 ] ) )# Days low temperature (eg. 50)
self.WINDOW.setProperty( "Day%s.HighTemperature" % ( day[ 0 ], ), self.localize_unit( day[ 3 ] ) )# Days high temperature (eg. 70)
self.WINDOW.setProperty( "Day%s.HighTemp" % ( day[ 0 ], ), self.localize_unit( day[ 3 ] ) )# Days high temperature (eg. 70)
self.WINDOW.setProperty( "Day%s.Sunrise" % ( day[ 0 ], ), self.localize_unit( day[ 5 ], "time" ) )# Days sunrise (eg. 7:39 AM)
self.WINDOW.setProperty( "Day%s.Sunset" % ( day[ 0 ], ), self.localize_unit( day[ 6 ], "time" ) )# Days sunset (eg. 7:02 PM)
# daytime forecast
skin/Confluence/720p/DialogPluginSettings.xml (working copy)
<window id="10140">
<defaultcontrol always="true">2</defaultcontrol>
<defaultcontrol always="true">9</defaultcontrol>
<coordinates>
<system>1</system>
<posx>160</posx>
......
<control type="label" id="20">
<description>header label</description>
<posx>300</posx>
<posy>30</posy>
<posy>20</posy>
<width>640</width>
<height>30</height>
<font>font16caps</font>
......
</control>
</controls>
</window>
xbmc/GUIDialogPluginSettings.cpp (working copy)
CGUIDialogPluginSettings::CGUIDialogPluginSettings()
: CGUIDialogBoxBase(WINDOW_DIALOG_PLUGIN_SETTINGS, "DialogPluginSettings.xml")
{}
{
m_currentSection = 0;
m_totalSections = 1;
}
CGUIDialogPluginSettings::~CGUIDialogPluginSettings(void)
{}
{
}
bool CGUIDialogPluginSettings::OnMessage(CGUIMessage& message)
{
......
}
return pDialog->m_bConfirmed;
}
return false;
else
{ // addon does not support settings, inform user
CGUIDialogOK::ShowAndGetInput(24000,0,24030,0);
return false;
}
}
// \brief Show CGUIDialogOK dialog, then wait for user to dismiss it.
......
}
return pDialog->m_bConfirmed;
}
return false;
else
{ // addon does not support settings, inform user
CGUIDialogOK::ShowAndGetInput(24000,0,24030,0);
return false;
}
}
bool CGUIDialogPluginSettings::ShowVirtualKeyboard(int iControl)
......
if (!source || strcmpi(source, "local") != 0)
g_mediaManager.GetNetworkLocations(networkShares);
localShares.insert(localShares.end(), networkShares.begin(), networkShares.end());
shares = &localShares;
}
else // always append local drives
{
localShares = *shares;
g_mediaManager.GetLocalDrives(localShares);
}
if (strcmpi(type, "folder") == 0)
{
......
if (option)
bWriteOnly = (strcmpi(option, "writeable") == 0);
if (CGUIDialogFileBrowser::ShowAndGetDirectory(*shares, label, value, bWriteOnly))
if (CGUIDialogFileBrowser::ShowAndGetDirectory(localShares, label, value, bWriteOnly))
((CGUIButtonControl*) control)->SetLabel2(value);
}
else if (strcmpi(type, "image") == 0)
{
if (CGUIDialogFileBrowser::ShowAndGetImage(*shares, label, value))
if (CGUIDialogFileBrowser::ShowAndGetImage(localShares, label, value))
((CGUIButtonControl*) control)->SetLabel2(value);
}
else
......
bUseFileDirectories = find(options.begin(), options.end(), "treatasfolder") != options.end();
}
if (CGUIDialogFileBrowser::ShowAndGetFile(*shares, strMask, label, value))
if (CGUIDialogFileBrowser::ShowAndGetFile(localShares, strMask, label, value))
((CGUIButtonControl*) control)->SetLabel2(value);
}
}
......
CStdString entries;
if (setting->Attribute("entries"))
entries = setting->Attribute("entries");
CStdString defaultValue;
if (setting->Attribute("default"))
defaultValue = setting->Attribute("default");
const char *subsetting = setting->Attribute("subsetting");
CStdString label = GetString(setting->Attribute("label"), subsetting && 0 == strcmpi(subsetting, "true"));
......
((CGUIButtonControl *)pControl)->SetLabel2(value);
}
else if (setting->Attribute("default"))
((CGUIButtonControl *)pControl)->SetLabel2(GetString(setting->Attribute("default")));
((CGUIButtonControl *)pControl)->SetLabel2(defaultValue);
}
else if (strcmpi(type, "bool") == 0)
{
xbmc/GUIWindowWeather.cpp (working copy)
CLog::Log(LOGDEBUG, "%s - Weather plugin called: %s (%s)", __FUNCTION__, argv[0], argv[1]);
forceRefresh = false;
delete [] argv;
}
xbmc/Util.cpp (working copy)
unsigned int argc = params.size();
char ** argv = new char*[argc];
vector<CStdString> path;
//split the path up to find the filename
StringUtils::SplitString(params[0],"\\",path);
argv[0] = path.size() > 0 ? (char*)path[path.size() - 1].c_str() : (char*)params[0].c_str();
argv[0] = (char*)params[0].c_str();
for(unsigned int i = 1; i < argc; i++)
argv[i] = (char*)params[i].c_str();
xbmc/utils/Weather.cpp (working copy)
{
}
CStdString CWeather::TranslateInfo(int info) const
const char *CWeather::TranslateInfo(int info)
{
CGUIWindow *window = g_windowManager.GetWindow(WINDOW_WEATHER);
if (window)
{
if (info == WEATHER_LABEL_CURRENT_COND)
return window->GetProperty("Current.Condition");
else if (info == WEATHER_IMAGE_CURRENT_ICON)
return window->GetProperty("Current.ConditionIcon");
else if (info == WEATHER_LABEL_CURRENT_TEMP)
return window->GetProperty("Current.Temperature");
else if (info == WEATHER_LABEL_LOCATION)
return window->GetProperty("Location");
else if (info == WEATHER_ISFETCHED)
return window->GetProperty("Weather.IsFetched");
else if (info == WEATHER_LABEL_FANART_CODE)
return window->GetProperty("Current.FanartCode");
}
SetInfo();
if (info == WEATHER_LABEL_CURRENT_COND)
return m_CurrentCondition;
else if (info == WEATHER_IMAGE_CURRENT_ICON)
return m_CurrentConditionIcon;
else if (info == WEATHER_LABEL_CURRENT_TEMP)
return m_CurrentTemperature;
else if (info == WEATHER_LABEL_LOCATION)
return m_CurrentLocation;
else if (info == WEATHER_LABEL_FANART_CODE)
return m_CurrentFanartCode;
else if (info == WEATHER_ISFETCHED)
return m_IsFetched;
return "";
}
......
void CWeather::Reset()
{
strcpy(m_CurrentCondition, "");
strcpy(m_CurrentConditionIcon, "");
strcpy(m_CurrentTemperature, "");
strcpy(m_CurrentLocation, "");
strcpy(m_CurrentFanartCode, "");
strcpy(m_IsFetched, "false");
for (int i = 0; i < MAX_LOCATION; i++)
{
m_szLocation[i] = "";
......
bool CWeather::IsFetched()
{
// call GetInfo() to make sure that we actually start up
GetInfo(0);
return TranslateInfo(WEATHER_ISFETCHED).Equals("true");
return (strcmp(GetInfo(WEATHER_ISFETCHED), "true") == 0);
}
void CWeather::SetInfo()
{
/*
if (strcmp(m_CurrentCondition, "") == 0 || strcmp(m_CurrentConditionIcon, "") == 0 ||
strcmp(m_CurrentTemperature, "") == 0 || strcmp(m_CurrentLocation, "") == 0 ||
strcmp(m_CurrentFanartCode, "") == 0 || strcmp(m_IsFetched, "false") == 0)
*/
if (0 == *m_CurrentCondition || 0 == *m_CurrentConditionIcon ||
0 == *m_CurrentTemperature || 0 == *m_CurrentLocation ||
0 == *m_CurrentFanartCode || strcmp(m_IsFetched, "false") == 0)
{
CLog::Log(LOGNOTICE, "SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS");
CGUIWindow *window = g_windowManager.GetWindow(WINDOW_WEATHER);
if (window)
{
// set these so existing weather infolabels don't break
strcpy(m_CurrentCondition, ((CGUIMediaWindow*)window)->GetProperty("Current.Condition").c_str());
strcpy(m_CurrentConditionIcon, ((CGUIMediaWindow*)window)->GetProperty("Current.ConditionIcon").c_str());
strcpy(m_CurrentTemperature, ((CGUIMediaWindow*)window)->GetProperty("Current.Temperature").c_str());
strcpy(m_CurrentLocation, ((CGUIMediaWindow*)window)->GetProperty("Location").c_str());
strcpy(m_CurrentFanartCode, ((CGUIMediaWindow*)window)->GetProperty("Current.FanartCode").c_str());
strcpy(m_IsFetched, ((CGUIMediaWindow*)window)->GetProperty("Weather.IsFetched").c_str());
}
}
}
xbmc/utils/Weather.h (working copy)
unsigned int GetMaxLocations();
protected:
virtual CStdString TranslateInfo(int info) const;
virtual const char *TranslateInfo(int info);
virtual DWORD TimeToNextRefreshInMs();
void SetInfo();
CStdString m_szLocation[10];
unsigned int m_iCurWeather;
int m_MaxLocations;
char m_szCurrentIcon[256];
char m_CurrentCondition[256];
char m_CurrentConditionIcon[256];
char m_CurrentTemperature[10];
char m_CurrentLocation[256];
char m_CurrentFanartCode[10];
char m_IsFetched[10];
};
extern CWeather g_weatherManager;
(12-12/13)