mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
.uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@4860 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
608f535a14
commit
3153931ddb
20 changed files with 444 additions and 173 deletions
|
|
@ -37,10 +37,21 @@ struct App : TopWindow {
|
|||
{
|
||||
}
|
||||
|
||||
void A()
|
||||
{
|
||||
Exclamation("LeftDouble");
|
||||
}
|
||||
|
||||
void B()
|
||||
{
|
||||
Exclamation("LeftClick");
|
||||
}
|
||||
|
||||
typedef App CLASSNAME;
|
||||
|
||||
App() {
|
||||
a.AddColumn("\1Text alsdfjla fdlajd flajd falsjkd fla fals fj");
|
||||
a.AddColumn("\1Text alsdfjla fdlajd flajd falsjkd fla fals fj").HeaderTab().WhenLeftDouble = THISBACK(A);
|
||||
a.AddColumn("asdf").HeaderTab().WhenLeftClick = THISBACK(B);
|
||||
a.MultiSelect();
|
||||
a.NoGrid();
|
||||
a.WhenDropInsert = THISBACK(DnDInsert);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ uses
|
|||
CtrlLib;
|
||||
|
||||
file
|
||||
|
||||
"main.cpp";
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
|
|
|
|||
4
uppdev/FileSel/init
Normal file
4
uppdev/FileSel/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _FileSel_icpp_init_stub
|
||||
#define _FileSel_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
|
|
@ -7,7 +7,7 @@ GUI_APP_MAIN
|
|||
SetDefaultCharset(CHARSET_UTF8);
|
||||
FileSel fs;
|
||||
String fn;
|
||||
fs.BaseDir("U:\\");
|
||||
// fs.BaseDir("U:\\");
|
||||
fs.AllFilesType()
|
||||
.Type( t_("archive FIDE (txt)"), "*.txt") //type 1
|
||||
.Type( t_("archive VEG (csv)"), "*.csv;*.veg") //type 2
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
#include <Web/Web.h>
|
||||
#include <Web/SSL/SSL.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
Cout() << HttpClient("www.rosettacode.org").ExecuteRedirect();
|
||||
|
||||
HttpClient::Trace();
|
||||
HttpsClient h;
|
||||
h.URL("www.google.com");
|
||||
h.Proxy("90.182.182.154", 8080);
|
||||
DDUMP(h.ExecuteRedirect());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
uses
|
||||
Core,
|
||||
Web;
|
||||
Web,
|
||||
Web/SSL;
|
||||
|
||||
file
|
||||
HTTPClient.cpp;
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
#define _HTTPClient_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#include "Web/init"
|
||||
#include "Web/SSL/init"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,18 +2,34 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
SQLID(ADDRESSBOOK);
|
||||
SQLID(FIRSTNAME);
|
||||
SQLID(ID);
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
MySqlSession session;
|
||||
// substitute your 'username' and 'password' here:
|
||||
if(!session.Connect("root", "heslo", "test", "10.0.0.19")) {
|
||||
if(!session.Connect("root", "Passw0rd", "adrbook", "localhost")) {
|
||||
DDUMP(session.GetErrorCodeString());
|
||||
printf("Can't connect with MySql\n");
|
||||
return;
|
||||
}
|
||||
Sql sql(session);
|
||||
sql.Execute("use test");
|
||||
SQL = session;
|
||||
|
||||
session.SetTrace();
|
||||
|
||||
Sql sql;
|
||||
sql.Execute("use adrbook");
|
||||
sql.Execute("show tables");
|
||||
while(sql.Fetch())
|
||||
Cout() << (String)sql[0] << '\n';
|
||||
SaveFile("u:/lego.sch", ExportSch(session, "test"));
|
||||
DDUMP((String)sql[0]);
|
||||
|
||||
SQL * Insert(ADDRESSBOOK)(FIRSTNAME, "Pepíček");
|
||||
|
||||
DDUMP(SQL.GetInsertedId());
|
||||
|
||||
sql * Select(SqlAll().Of(ADDRESSBOOK)).From(ADDRESSBOOK);
|
||||
while(sql.Fetch())
|
||||
DDUMP(sql.GetRowMap());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Logging to MySql";
|
||||
description "Logging to MySql\377";
|
||||
|
||||
uses
|
||||
MySql;
|
||||
|
|
@ -8,3 +8,4 @@ file
|
|||
|
||||
mainconfig
|
||||
"" = "MT";
|
||||
|
||||
|
|
|
|||
4
uppdev/SQL_MySql/init
Normal file
4
uppdev/SQL_MySql/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SQL_MySql_icpp_init_stub
|
||||
#define _SQL_MySql_icpp_init_stub
|
||||
#include "MySql/init"
|
||||
#endif
|
||||
|
|
@ -7,7 +7,7 @@ CONSOLE_APP_MAIN
|
|||
{
|
||||
MySqlSession session;
|
||||
// substitute your 'username' and 'password' here:
|
||||
if(!session.Connect("root", "koblih", "mysql", "localhost")) {
|
||||
if(!session.Connect("root", "Passw0rd", "mysql", "localhost")) {
|
||||
printf("Can't connect with MySql\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
#define SQLID(x) SqlId x(#x)
|
||||
|
||||
SQLID(COLUMN);
|
||||
SQLID(COLUMN1);
|
||||
SQLID(COLUMN2);
|
||||
|
|
@ -39,6 +37,9 @@ void Put(String s, const char *splits)
|
|||
|
||||
void Exp(const char *s, SqlStatement sql)
|
||||
{
|
||||
DDUMP(s);
|
||||
DDUMP(sql.Get(PGSQL));
|
||||
|
||||
qtf << "\n:: ";
|
||||
Put(s, ".From;.Where;.OrderBy");
|
||||
qtf << "\n:: ";
|
||||
|
|
@ -47,6 +48,8 @@ void Exp(const char *s, SqlStatement sql)
|
|||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
DLOG(SqlCompile(PGSQL, String().Cat() << '\t' << TABLE(COLUMN1, COLUMN2) << '\t' << " from \t" << TABLE << "\t"));
|
||||
// return;
|
||||
qtf << "[C1 {{1:1 SqlExp C`+`+:: PostgreSQL";
|
||||
EXP(Select(COLUMN).From(TABLE));
|
||||
EXP(Select(COLUMN.Of(TABLE)).From(TABLE));
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@ file
|
|||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
|
|||
8
uppdev/google_upload/google_upload.cpp
Normal file
8
uppdev/google_upload/google_upload.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include <Web/SSL/SSL.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
|
||||
}
|
||||
11
uppdev/google_upload/google_upload.upp
Normal file
11
uppdev/google_upload/google_upload.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses
|
||||
Core,
|
||||
Web/SSL;
|
||||
|
||||
file
|
||||
up.py,
|
||||
google_upload.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
5
uppdev/google_upload/init
Normal file
5
uppdev/google_upload/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _google_upload_icpp_init_stub
|
||||
#define _google_upload_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#include "Web/SSL/init"
|
||||
#endif
|
||||
192
uppdev/google_upload/up.py
Normal file
192
uppdev/google_upload/up.py
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
|
||||
|
||||
def upload(file, project_name, user_name, password, summary, labels=None):
|
||||
"""Upload a file to a Google Code project's file server.
|
||||
|
||||
Args:
|
||||
file: The local path to the file.
|
||||
project_name: The name of your project on Google Code.
|
||||
user_name: Your Google account name.
|
||||
password: The googlecode.com password for your account.
|
||||
Note that this is NOT your global Google Account password!
|
||||
summary: A small description for the file.
|
||||
labels: an optional list of label strings with which to tag the file.
|
||||
|
||||
Returns: a tuple:
|
||||
http_status: 201 if the upload succeeded, something else if an
|
||||
error occured.
|
||||
http_reason: The human-readable string associated with http_status
|
||||
file_url: If the upload succeeded, the URL of the file on Google
|
||||
Code, None otherwise.
|
||||
"""
|
||||
# The login is the user part of user@gmail.com. If the login provided
|
||||
# is in the full user@domain form, strip it down.
|
||||
if user_name.endswith('@gmail.com'):
|
||||
user_name = user_name[:user_name.index('@gmail.com')]
|
||||
|
||||
form_fields = [('summary', summary)]
|
||||
if labels is not None:
|
||||
form_fields.extend([('label', l.strip()) for l in labels])
|
||||
|
||||
content_type, body = encode_upload_request(form_fields, file)
|
||||
|
||||
upload_host = '%s.googlecode.com' % project_name
|
||||
upload_uri = '/files'
|
||||
auth_token = base64.b64encode('%s:%s'% (user_name, password))
|
||||
headers = {
|
||||
'Authorization': 'Basic %s' % auth_token,
|
||||
'User-Agent': 'Googlecode.com uploader v0.9.4',
|
||||
'Content-Type': content_type,
|
||||
}
|
||||
|
||||
server = httplib.HTTPSConnection(upload_host)
|
||||
server.request('POST', upload_uri, body, headers)
|
||||
resp = server.getresponse()
|
||||
server.close()
|
||||
|
||||
if resp.status == 201:
|
||||
location = resp.getheader('Location', None)
|
||||
else:
|
||||
location = None
|
||||
return resp.status, resp.reason, location
|
||||
|
||||
|
||||
def encode_upload_request(fields, file_path):
|
||||
"""Encode the given fields and file into a multipart form body.
|
||||
|
||||
fields is a sequence of (name, value) pairs. file is the path of
|
||||
the file to upload. The file will be uploaded to Google Code with
|
||||
the same file name.
|
||||
|
||||
Returns: (content_type, body) ready for httplib.HTTP instance
|
||||
"""
|
||||
BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
|
||||
CRLF = '\r\n'
|
||||
|
||||
body = []
|
||||
|
||||
# Add the metadata about the upload first
|
||||
for key, value in fields:
|
||||
body.extend(
|
||||
['--' + BOUNDARY,
|
||||
'Content-Disposition: form-data; name="%s"' % key,
|
||||
'',
|
||||
value,
|
||||
])
|
||||
|
||||
# Now add the file itself
|
||||
file_name = os.path.basename(file_path)
|
||||
f = open(file_path, 'rb')
|
||||
file_content = f.read()
|
||||
f.close()
|
||||
|
||||
body.extend(
|
||||
['--' + BOUNDARY,
|
||||
'Content-Disposition: form-data; name="filename"; filename="%s"'
|
||||
% file_name,
|
||||
# The upload server determines the mime-type, no need to set it.
|
||||
'Content-Type: application/octet-stream',
|
||||
'',
|
||||
file_content,
|
||||
])
|
||||
|
||||
# Finalize the form body
|
||||
body.extend(['--' + BOUNDARY + '--', ''])
|
||||
|
||||
return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
|
||||
|
||||
|
||||
def upload_find_auth(file_path, project_name, summary, labels=None,
|
||||
user_name=None, password=None, tries=3):
|
||||
"""Find credentials and upload a file to a Google Code project's file server.
|
||||
|
||||
file_path, project_name, summary, and labels are passed as-is to upload.
|
||||
|
||||
Args:
|
||||
file_path: The local path to the file.
|
||||
project_name: The name of your project on Google Code.
|
||||
summary: A small description for the file.
|
||||
labels: an optional list of label strings with which to tag the file.
|
||||
config_dir: Path to Subversion configuration directory, 'none', or None.
|
||||
user_name: Your Google account name.
|
||||
tries: How many attempts to make.
|
||||
"""
|
||||
|
||||
while tries > 0:
|
||||
if user_name is None:
|
||||
# Read username if not specified or loaded from svn config, or on
|
||||
# subsequent tries.
|
||||
sys.stdout.write('Please enter your googlecode.com username: ')
|
||||
sys.stdout.flush()
|
||||
user_name = sys.stdin.readline().rstrip()
|
||||
if password is None:
|
||||
# Read password if not loaded from svn config, or on subsequent tries.
|
||||
print 'Please enter your googlecode.com password.'
|
||||
print '** Note that this is NOT your Gmail account password! **'
|
||||
print 'It is the password you use to access Subversion repositories,'
|
||||
print 'and can be found here: http://code.google.com/hosting/settings'
|
||||
password = getpass.getpass()
|
||||
|
||||
status, reason, url = upload(file_path, project_name, user_name, password,
|
||||
summary, labels)
|
||||
# Returns 403 Forbidden instead of 401 Unauthorized for bad
|
||||
# credentials as of 2007-07-17.
|
||||
if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
|
||||
# Rest for another try.
|
||||
user_name = password = None
|
||||
tries = tries - 1
|
||||
else:
|
||||
# We're done.
|
||||
break
|
||||
|
||||
return status, reason, url
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
|
||||
'-p PROJECT [options] FILE')
|
||||
parser.add_option('-s', '--summary', dest='summary',
|
||||
help='Short description of the file')
|
||||
parser.add_option('-p', '--project', dest='project',
|
||||
help='Google Code project name')
|
||||
parser.add_option('-u', '--user', dest='user',
|
||||
help='Your Google Code username')
|
||||
parser.add_option('-w', '--password', dest='password',
|
||||
help='Your Google Code password')
|
||||
parser.add_option('-l', '--labels', dest='labels',
|
||||
help='An optional list of comma-separated labels to attach '
|
||||
'to the file')
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if not options.summary:
|
||||
parser.error('File summary is missing.')
|
||||
elif not options.project:
|
||||
parser.error('Project name is missing.')
|
||||
elif len(args) < 1:
|
||||
parser.error('File to upload not provided.')
|
||||
elif len(args) > 1:
|
||||
parser.error('Only one file may be specified.')
|
||||
|
||||
file_path = args[0]
|
||||
|
||||
if options.labels:
|
||||
labels = options.labels.split(',')
|
||||
else:
|
||||
labels = None
|
||||
|
||||
status, reason, url = upload_find_auth(file_path, options.project,
|
||||
options.summary, labels,
|
||||
options.user, options.password)
|
||||
if url:
|
||||
print 'The file was uploaded successfully.'
|
||||
print 'URL: %s' % url
|
||||
return 0
|
||||
else:
|
||||
print 'An error occurred. Your file was not uploaded.'
|
||||
print 'Google Code upload server said: %s (%s)' % (reason, status)
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
@ -2,4 +2,5 @@
|
|||
#define _testssl_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#include "Web\SSL/init"
|
||||
#include "Core/SSL/init"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
#include <Core/Core.h>
|
||||
#include <Web/SSL/SSL.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
HttpClient::Trace();
|
||||
HttpsClient client;
|
||||
client.URL("www.google.cz");
|
||||
DDUMP(client.Execute());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
uses
|
||||
Core,
|
||||
Web\SSL;
|
||||
Web\SSL,
|
||||
Core/SSL;
|
||||
|
||||
file
|
||||
testssl.cpp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue