2
0
forked from Ivasoft/DSView

Set python home at windows os

This commit is contained in:
dreamsourcelabTAI
2021-12-13 09:18:03 +08:00
parent 26f4e65b7b
commit a16b97cf90
10 changed files with 36 additions and 13 deletions

View File

@@ -42,7 +42,7 @@
void usage()
{
fprintf(stdout,
printf(
"Usage:\n"
" %s [OPTION…] [FILE] — %s\n"
"\n"
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
case 'V':
// Print version info
fprintf(stdout, "%s %s\n", DS_TITLE, DS_VERSION_STRING);
printf("%s %s\n", DS_TITLE, DS_VERSION_STRING);
return 0;
case 'h':
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
}
if (argcFinal - optind > 1) {
fprintf(stderr, "Only one file can be openened.\n");
printf("Only one file can be openened.\n");
return 1;
} else if (argcFinal - optind == 1){
open_file = argvFinal[argcFinal - 1];
@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
//init core
if (!control->Init()){
fprintf(stderr, "init error!");
printf("init error!");
qDebug() << control->GetLastError();
return 1;
}
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
}
catch (const std::exception &e)
{
fprintf(stderr, "main() catch a except!");
printf("main() catch a except!");
const char *exstr = e.what();
qDebug() << exstr;
}

View File

@@ -75,7 +75,18 @@ bool AppControl::Init()
}
QString resdir = GetResourceDir();
sr_set_firmware_resource_dir(resdir.toUtf8());
sr_set_firmware_resource_dir(resdir.toUtf8().data());
#ifdef _WIN32
QString pythonHome = GetAppDataDir() + "/Python";
QDir pydir;
if (pydir.exists(pythonHome)){
srd_set_python_home(pythonHome.toUtf8().data());
}else{
qDebug()<<"python home directory not exists,"<<pythonHome;
}
#endif
QString dir = GetAppDataDir() + "/decoders";
char path[256] = {0};

View File

@@ -23,6 +23,7 @@
#include <libsigrokdecode4DSL/libsigrokdecode.h>
#include "sigsession.h"
#include "mainwindow.h"
#include "devicemanager.h"

View File

@@ -22,9 +22,7 @@
#ifndef DSVIEW_PV_SIGSESSION_H
#define DSVIEW_PV_SIGSESSION_H
#include <libsigrok4DSL/libsigrok.h>
#include <set>
#include <string>
#include <vector>
@@ -39,8 +37,11 @@
#include "interface/icallbacks.h"
#include "dstimer.h"
#include <libsigrok4DSL/libsigrok.h>
struct srd_decoder;
struct srd_channel;
class DecoderStatus;

View File

@@ -188,7 +188,8 @@ void TitleBar::setRestoreButton(bool max)
void TitleBar::mousePressEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton && !parentWidget()->isMaximized()) {
if(event->button() == Qt::LeftButton && !parentWidget()->isMaximized())
{
int x = event->pos().x();
int y = event->pos().y();
bool bTopWidow = app::is_app_top_window(_parent);

View File

@@ -26,6 +26,7 @@ Requirements
This is part of the standard OpenBSD install (not an extra package), apparently.
- check >= 0.9.4 (optional, only needed to run unit tests)
- libfftw3 >= 3.3
- zlib
Building and installing
-----------------------

View File

@@ -361,6 +361,7 @@ struct srd_pd_callback {
SRD_API int srd_init(const char *path);
SRD_API int srd_exit(void);
SRD_API GSList *srd_searchpaths_get(void);
SRD_API void srd_set_python_home(const char *path);
/* session.c */
SRD_API int srd_session_new(struct srd_session **sess);

View File

@@ -386,4 +386,10 @@ SRD_API GSList *srd_searchpaths_get(void)
return paths;
}
//set python home directory
SRD_API void srd_set_python_home(const char *path)
{
Py_SetPythonHome((wchar_t*)path);
}
/** @} */

View File

@@ -13,8 +13,9 @@ QT += svg
CONFIG += exceptions
CONFIG += object_parallel_to_source
greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
//QT += core5compat
CONFIG += c++11
QT += widgets
#QMAKE_CFLAGS_ISYSTEM = -I

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2021-12-03T18:50:47. -->
<!-- Written by QtCreator 4.11.0, 2021-12-10T18:13:59. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>